Powershell script gets stuck, doesn't exit when called from batch file

前端 未结 10 665
不知归路
不知归路 2020-12-24 11:08

I have a PowerShell script that connects to a web site, and parses its returned data (It\'s about importing a previously uploaded SQL file into the web site\'s data base). T

10条回答
  •  没有蜡笔的小新
    2020-12-24 11:47

    If you want to capture the output of the powershell.exe commands then you can also use the /B parameter to force the process to run in the same command shell.

    We've just seen a very odd instance of this problem. A batch file containing the call powershell.exe -command ... ran fine locally but stalled as described above when the batch file was run in the context of an msdeploy -postSync command. After experimenting with process.Kill() to force PowerShell to quit, we lit on the use of START /WAIT /B PowerShell.exe ..

    No idea why this should work, but it does ...

提交回复
热议问题