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
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
Summary: You don't need to use that external (3rd party, I guess) application for that. On windows 2000, do: for /F "tokens=2" %%A in ("%DATE%") do set LOG=%%A for /F "tokens=1 delims=." %%A in ("%TIME%") do s...
Summary: This will do it: :: Send the length of the variable %MyVar% :: to the variable %length% set #=%MyVar% set length=0 :loop if defined # (set #=%#:~1%&set /A length += 1&goto loop) echo MyVar is %length%...
Summary: Jen Cheng wrote: > After looking at your site, I thought I'd mention that > I am running XP, will these commands still work? I've developed the batch scripts based on the OS you reported (Windows XP P...