Help: CMD BatFile Question


  1. Posts : 1
    Windows 7
       #1

    Help: CMD BatFile Question


    Hey I have a Question with Windows bat file...

    Is there a way to set a if statement for a system error 5

    Ex.
    Echo off
    Title Test
    cd/Users
    cls
    net user /add Frog 123456 (Giving System Error 5 if not ran as admin)
    if system error 5 goto error
    echo account made
    pause
    :error
    echo ERROR Not Admin
    pause

    ____________________________________________________________________
    I typed that quick so their might be bugs... but if someone can help please do...

    Thanks
      My Computer


  2. Posts : 3,322
    Windows 8.1 Pro x64
       #2

    I think it's just:

    IF ERRORLEVEL 5

    which would of course be for exit code 5.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 20:38.
Find Us