start-process in Powershell closes Window automatically after execution is complete

10,239

Solution 1

Try passing -noexit as a parameter to powershell.exe when you start it.

Solution 2

you mean start a command prompt? right? if so, hope following script could be helpful

Start-Process cmd -ArgumentList '/c','echo test' # auto close
Start-Process cmd -ArgumentList '/k','echo test' # keep waiting
Share:
10,239
yingzhox
Author by

yingzhox

Updated on June 22, 2022

Comments

  • yingzhox
    yingzhox almost 2 years

    I find that if I start a process by start-process in powershell , the new window will be closed automatically after execution complete , is it possible to keep it waiting for my further command to close?