[英]How can I start a process, pause for 2 hours and then kill a process in Powershell
[英]how i can start process with large multiline script block in powershell?
我想用脚本块启动进程powershell。 像这样的代码。
start-process powershell.exe -ArgumentList "-noexit","-command {
set-Set-ExecutionPolicy bypass -force
get-help get-process
get-command -commandtype cmdlet
...
}"
Command的参数应该是ArgumentList中的另一个未合并到-command中的元素。
即
Start-Process powershell.exe -ArgumentList "-noexit", "-command", "Get-Process"
无论您执行的是简单命令还是更长的命令(很长的字符串),这都适用。
您可以使用此方法:
Start-Process powershell.exe -ArgumentList "-noexit", "-command", "help
dir
get-command
"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.