[英]how i can start process with large multiline script block in powershell?
i wanna start process powershell with script block . 我想用脚本块启动进程powershell。 like this code.
像这样的代码。
start-process powershell.exe -ArgumentList "-noexit","-command {
set-Set-ExecutionPolicy bypass -force
get-help get-process
get-command -commandtype cmdlet
...
}"
The argument for Command should be another element in the ArgumentList not merged into -command. Command的参数应该是ArgumentList中的另一个未合并到-command中的元素。
ie 即
Start-Process powershell.exe -ArgumentList "-noexit", "-command", "Get-Process"
This applies whether the thing you're executing is a simple command or a longer command (a very long string). 无论您执行的是简单命令还是更长的命令(很长的字符串),这都适用。
you can use this method : 您可以使用此方法:
Start-Process powershell.exe -ArgumentList "-noexit", "-command", "help
dir
get-command
"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.