[ros-bugs] [Bug 6206] New: %ERRORLEVEL% not being set correctly

ReactOS.Bugzilla at reactos.org ReactOS.Bugzilla at reactos.org
Wed May 4 16:54:51 UTC 2011


http://www.reactos.org/bugzilla/show_bug.cgi?id=6206

           Summary: %ERRORLEVEL% not being set correctly
           Product: ReactOS
           Version: TRUNK
          Platform: x86 Hardware
        OS/Version: ReactOS
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: Tools
        AssignedTo: ros-bugs at reactos.org
        ReportedBy: dmex04 at gmail.com
         QAContact: ros-bugs at reactos.org


The %ERRORLEVEL% variable is not being set by cmd after a command is executed,
this breaks all bat scripts that rely upon this behavior and users that need a
result code after a failure to execute a program or command.

Consider the following output from the Windows command prompt:

C:\Users\dmex>echo %ERRORLEVEL%
0

C:\Users\dmex>ping 127.fail
Ping request could not find host 127.fail. Please check the name and try again.

C:\Users\dmex>echo %ERRORLEVEL%
1

C:\Users\dmex>ping 127.0.0.1

Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\Users\dmex>echo %ERRORLEVEL%
0


ReactOS output, I manually set the ERRORLEVEL to 999 to test and confirm it
indeed does not reset the variable. This result is for every application
started via command including GUI applications:

C:\ReactOS\system32>echo %ERRORLEVEL%
0

C:\ReactOS\system32>ping 127.fail
Unknown host 127.fail.

C:\ReactOS\system32>echo %ERRORLEVEL%
0

C:\ReactOS\system32>set ERRORLEVEL=999

C:\ReactOS\system32>echo %ERRORLEVEL%
999

C:\ReactOS\system32>ping 127.0.0.1

Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\ReactOS\system32>echo %ERRORLEVEL%
999


-- 
Configure bugmail: http://www.reactos.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.



More information about the Ros-bugs mailing list