Ale*_*lis 5 vbscript powershell
嘿,我想从 vbs 脚本运行一个 powershell 突击队。启动 powershell.exe 之类的东西,然后输入特定的命令,例如 Restart-Service。我认为类似的东西可以工作:
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)
Run Code Online (Sandbox Code Playgroud)
有人知道我该如何管理吗?
小智 5
1)将您的powershell命令存储为powershell脚本。
2)使用vbs运行powershell
Set objShell = CreateObject("Wscript.Shell")
objShell.Run("powershell.exe -noexit c:\scripts\test.ps1")
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
44646 次 |
最近记录: |