ps腳本,獲取進程可執行程序路徑:Get-Process -Name Cmd | Select-Object Path 必須是正在運行的進程,否則報錯。
ps腳本,列出正在運行的進程信息:tasklist
cmd腳本,獲取進程可執行程序路徑:wmic process where name="cmd.exe" get ExecutablePath
通過cmd調用PowerShell:powershell -ExecutionPolicy Bypass -File "C:\path\to\your\script\yourscript.ps1"
通過PowerShell執行ps1腳本文件:cd C:\path\to\your\script 然后執行:.\yourscript.ps1
ps腳本,列出正在運行的進程信息:tasklist
cmd腳本,獲取進程可執行程序路徑:wmic process where name="cmd.exe" get ExecutablePath
通過cmd調用PowerShell:powershell -ExecutionPolicy Bypass -File "C:\path\to\your\script\yourscript.ps1"
通過PowerShell執行ps1腳本文件:cd C:\path\to\your\script 然后執行:.\yourscript.ps1
浙公網安備 33010602011771號