The Powershell.exe does not set an exit code when -File is used.If we have a .PS1 file called error.ps1 with the following script: throw "Help"and from CMD.exe we execute it with the -command parameter in the following way. powershell -command .'d:\error.ps1'Then the exit code in %errorlevel% is set to 1.On the other hand, if we execute powershell.exe with the -file parameter in the following way: powershell -file 'd:\error.ps1'Then the exit code in %errorlevel% is set to 0.
Have you seen this problem before in this product?