hybrid batch powershell script - exitcode

17 views
Skip to first unread message

Petr Laznovsky

unread,
Feb 2, 2020, 12:21:56 PM2/2/20
to
Running powershell oneliners inside of my batch script and want to check
if powershell terminate with error or exit correctly. Tried to read
%errorlevel% value just after oneliner terminate, but is always '0'. is
there any way to check powershell exitcode?


some_batch_code_here............
powershell.exe -command "& { iwr http://www.it1.net/it1_logo2.jpg
-OutFile logo.jpg }"
echo %errorlevel%
0
some_other_batch_code_here..............

L.
Reply all
Reply to author
Forward
0 new messages