in reply to perl and windows batch

Given error.bat:

c:\test>type error.bat @echo off exit /b 123

Use:

system 'error.bat & exit ERRORLEVEL';; print $? >>8;; 123

Note: Because Perl attempts to emulate *nix here, exit codes (ERRORLEVELs) are truncated to 8 bits.

Or, skip using /b:

c:\test>type error.bat @echo off exit 123 c:\test>p1 [0] Perl> system 'error.bat'; print $? >>8;; 123

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: perl and windows batch
by leonidlm (Pilgrim) on Jul 31, 2008 at 11:54 UTC
    Thanks all
    The BrowserUk solution worked for me! Very good explanation also :)