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

前端 未结 10 649
不知归路
不知归路 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:54

    This variant might work for you.

    powershell -NoProfile -Command "C:\data\etc\run_import_script.ps1; exit $LASTEXITCODE" < NUL
    

    Taken from http://thepowershellguy.com/blogs/posh/archive/2008/05/20/hey-powershell-guy-how-can-i-run-a-powershell-script-from-cmd-exe-and-return-an-errorlevel.aspx

提交回复
热议问题