我有一個啟動行程的 PowerShell 腳本:
$pythodDir, $argsOriginalList = $args
$pythonExePath = Join-Path $pythodDir "python.exe"
$argsList = @("--no-render") $argsOriginalList
Start-Process -FilePath $pythonExePath -ArgumentList $argsList
我希望看到Start-Process例如的完整命令列:
C:\python\python.exe --no-render --arg1 value
我沒有找到一個標志來呈現Start-Process創建的完整命令。有沒有辦法詳細說明它?
uj5u.com熱心網友回復:
ProcessInfo您可以通過從您啟動的行程中獲取兩個屬性來獲取命令列:
# Capture the process object using -PassThru
$p = Start-Process -FilePath $pythonExePath -ArgumentList $argsList -PassThru
# Output the command line
($p.StartInfo.FileName,$p.StartInfo.Arguments) -join ' '
例如:
$p = Start-Process -FilePath 'Notepad.exe' -ArgumentList 'c:\folder\file.txt' -PassThru
($p.StartInfo.FileName,$p.StartInfo.Arguments) -join ' '
C:\WINDOWS\system32\notepad.exe C:\folder\file.txt
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/444125.html
標籤:电源外壳
上一篇:啟動服務后腳本拋出錯誤
