Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 440
  • Last Modified:

Query Environment Variable in a DOS Script

okay, i probably knew this one 20 years ago but my brain is now fogged ...

I have a simple DOS script:

IF  my_environment_variable == 1 then a.bat ELSE b.bat

and its failing the test for equal to 1;  I've tried "1" and '1' with no luck.  

how do I make this work?
0
jmorgie
Asked:
jmorgie
1 Solution
 
SteveGTRCommented:
Do this:

@echo off

if "%EnvVar%"=="1" (
  echo EnvVar is 1
) else (
  echo EndVar is not 1
)

Good Luck,
Steve
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now