Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 990933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:01:36+00:00 2026-05-16T06:01:36+00:00

Since ERRORLEVEL is an environment variable isn’t it possible that its value can be

  • 0

Since ERRORLEVEL is an environment variable isn’t it possible that its value can be changed before I get a chance to check it in my batch file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:01:37+00:00Added an answer on May 16, 2026 at 6:01 am

    Environment variables belong to the current “process” so they can’t be changed from outside. Provided you check the error level after the relevant command in your batch file, you should be checking the right value.

    You can confirm this by opening up two command windows and entering into the first:

    c:> set errorlevel=7
    

    and then the second:

    c:> set errorlevel=9
    

    then go back to the first and:

    c:> echo %errorlevel%
    7
    

    You should be very careful about setting the errorlevel environment variable by the way. That particular variable is a special one in that, when you haven’t set it specifically, it will automatically serve up the return code from the previous program.

    Setting it explicitly overrides this behaviour, and the only way to recover is to either use if errorlevel N(a) instead of the environment variable (it bypasses the environment variable), or use set errorlevel= to remove the override.


    (a) The correct way to do this is mandated by fact that the errorlevel expression is true if the error level is greater than or equal to the value specified. Because of that, you should do it in reverse order, something like:

    if errorlevel 3 goto :got3ormore
    if errorlevel 2 goto :got2
    if errorlevel 1 goto :got1
    if errorlevel 0 goto :got0
    goto :gotnegative
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since each thread has its own stack, its private data can be put on
since every assignment to a variable with a different object increases its retain count
Since Haskell's data are Immutable,how would you globally store a list that can be
Since REST is stateless, each request that comes in has no knowledge of the
Since functions are first class objects, it should be possible to assign to the
Sometimes its the simple things you thought you knew that make your head buzzz....
Since recent runtimes in iOS, we are able to define properties that will generate
Since multiple requests can slow down the speed at which a site loads, I
Since Java char is 16 bit long, I am wondering how can it represent
Since I added some scrollTop -animation, some parts of my callback get called twice:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.