• hybrid batch powershell script - exitcode

    From Petr Laznovsky@21:1/5 to All on Sun Feb 2 18:21:53 2020
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)