嘿,我想從一個vbs腳本運行一個powershell命令。像啓動powershell.exe,並輸入一個特定的命令,如重新啓動服務。我以爲類似的東西可以工作:從命令行運行Powershell作爲參數
strCommand = "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -command Restart-Service [service name]"
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objExec = WshShell.Exec(strCommand)
有人的想法我怎麼能管理這個?
這將幫助:http://ss64.com/vb/run.html – 2012-07-12 09:13:13
我已經設置了這樣的'點心objShell 設置objShell = WScript.CreateObject( 「WScript.shell」) objShell。運行「C:\ WINDOWS \ system32 \ WindowsPowerShell \ v1.0 \ powershell.exe&重新啓動服務BranchCache」 Set objShell = Nothing'但是不起作用。 – Alesfatalis 2012-07-12 09:28:10
看看PowerShell.exe的命令行參數。使用一個告訴PowerShell運行一個命令... – 2012-07-12 09:42:05