Computing.Net > Forums > Disk Operating System > if defined

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

if defined

Reply to Message Icon

Name: gitarwmn
Date: May 21, 2004 at 16:27:54 Pacific
OS: Windows 2000
CPU/Ram: 500 256meg
Comment:

I'm trying to run a line in a script that sees if a variable is defined and then echo's that variable if it is defined. Basically it looks like this...

if defined "%MSLABEL%" @echo %MSLABEL%

When I run the line I get no errors but nothing gets echoed. Does anyone have an idea about how to echo the variable name if it is defined. Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: SpiderMSN
Date: May 21, 2004 at 18:15:57 Pacific
Reply:

use if not == echo. You do not need an @ symbol, even if running from the command prompt. For instance this line works:

IF NOT "%CMDCMDLINE%"=="" ECHO %CMDCMDLINE%


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: if defined

How to create a log file in 1 line www.computing.net/answers/dos/how-to-create-a-log-file-in-1-line/12735.html

length of a string in a batch file www.computing.net/answers/dos/length-of-a-string-in-a-batch-file/13650.html

Batch File Madness www.computing.net/answers/dos/batch-file-madness/13152.html