Download env.ps1 from laindsw/450: direct link, hf CLI and curl.
- Browser
- Download file 698 Bytes
-
https://huggingface.co/spaces/laindsw/450/resolve/main/env.ps1
- Command line
-
hf download hf://spaces/laindsw/450/env.ps1
-
curl -L -o env.ps1 https://huggingface.co/spaces/laindsw/450/resolve/main/env.ps1
698 Bytes
| function Load-EnvVariables { | |
| param ( | |
| [string]$EnvFilePath = ".\.env" | |
| ) | |
| if (Test-Path -Path $EnvFilePath) { | |
| $envContent = Get-Content -Path $EnvFilePath | |
| foreach ($line in $envContent) { | |
| if ($line -notmatch '^\s*(#|$)') { | |
| $keyValue = $line -split '=', 2 | |
| if ($keyValue.Length -eq 2) { | |
| $key = $keyValue[0].Trim() | |
| $value = $keyValue[1].Trim() | |
| Set-Item -Path "env:$key" -Value $value | |
| } | |
| } | |
| } | |
| } else { | |
| Write-Warning "未找到.env文件: $EnvFilePath" | |
| } | |
| } | |
| # 调用函数来加载环境变量 | |
| Load-EnvVariables |