I have a perl file that calls a batch file to do an installation of a 3rd party program.
Main.pl
system ("Installer.bat");
print "Error code is $? \n";
Installer.bat
@echo off
installer.exe
echo errorlevel is %errorlevel% > logfile
exit %errorlevel%
The error code 3010 is returned by the batch file and it suggests that a restart is required. However, the perl module prints 49664. I thought it was supposed to print 3010. Could someone please explain how this works? I want to get the error code for a restart required in my perl code and then do some cleanup work and restart the machine from the perl module.
The following related points are also not clear. - Windows batch files only have 255 error codes, so how can 3010 be returned as a error code? - This place suggests that we need to right shift the error code by 8 bits to get the native error code. So if I right shift 49664 by 8, I get 194 (which is still not the same as 3010). However I also note that 3010 Mod 256 = 194