Computing.Net > Forums > Programming > FOR Statment, MAX using Variable

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.

FOR Statment, MAX using Variable

Reply to Message Icon

Name: cardguy1000
Date: December 26, 2003 at 02:12:45 Pacific
OS: XP
CPU/Ram: 2000+/768
Comment:

I'm trying to make a batch file in dos, and I can't seem to get a Variable to work as my MAX in a FOR statement, here is my code:
SET NumDisks = 5
FOR /L %%i IN (1, 1, %NumDisks%) DO (ECHO Test)

If I replace %NumDisks% with 5 it works, can you not use variables as your max or is my syntax wrong??? Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: December 26, 2003 at 07:00:07 Pacific
Reply:

Hi Jeff

Don't use spaces in the SET command
ie. SET NumDisks=5


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 Programming Forum Home


Sponsored links

Ads by Google


Results for: FOR Statment, MAX using Variable

DOS batch file to list used variabl www.computing.net/answers/programming/dos-batch-file-to-list-used-variabl/17937.html

BATCH using variables www.computing.net/answers/programming/batch-using-variables/15611.html

variables in batch FOR loops www.computing.net/answers/programming/variables-in-batch-for-loops/16372.html