让 BLE 启动脚本读取用户环境变量
This commit is contained in:
parent
704f8a4e5d
commit
6468e91c7a
@ -17,6 +17,16 @@ $pidFile = Join-Path $scriptDir "metrics-ble.pid"
|
||||
$logFile = Join-Path $scriptDir "metrics-ble.log"
|
||||
$errFile = Join-Path $scriptDir "metrics-ble.err.log"
|
||||
|
||||
foreach ($envName in @("ZHIPU_API_KEY", "ZHIPU_BASE_URL")) {
|
||||
$processValue = [Environment]::GetEnvironmentVariable($envName, "Process")
|
||||
if (-not $processValue) {
|
||||
$userValue = [Environment]::GetEnvironmentVariable($envName, "User")
|
||||
if ($userValue) {
|
||||
[Environment]::SetEnvironmentVariable($envName, $userValue, "Process")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get-MetricsProcesses {
|
||||
Get-CimInstance Win32_Process -Filter "name='python.exe'" |
|
||||
Where-Object { $_.CommandLine -and $_.CommandLine.Contains($pushScript) }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user