Windows PowerShell Home
Powershell.exe does not set an exit code when -File is used.
1/24/2013 5:26:01 AM
User(s) can reproduce this bug
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:
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.
How often does this happen?
Have you seen this problem before in this product?
Yes, this happens in previous released versions
%errorlevel% set to 1
to post a comment.
Please enter a comment.
to post a workaround.
Please enter a workaround.
© 2013 Microsoft