Start PowerShell with -NoExit not working

杀马特。学长 韩版系。学妹 提交于 2021-01-27 15:06:28

问题


Need to launch several jobs in PowerShell, but they should be in different sessions. So to launch one, one could use:

Start-Process powershell -ArgumentList "-command &{Get-Process}","-noexit","-noprofile"

But the new window closes as soon as the command finishes. Even though I'm using -NoExit parameter. Acording to this article and this question, this should work. Even tried to block the window, by waiting for an user input, but it just closes.


回答1:


While the command parameters are named, position is still critical (see PowerShell.exe /?):

Start-Process powershell -ArgumentList "-noexit", "-noprofile", "-command &{Get-Process}"


来源:https://stackoverflow.com/questions/38831008/start-powershell-with-noexit-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!