Hello all. I am new to DOS scripting, and we have an assignment at school. We were told:
"Write a script that displays odd numbers beginning with 49 and descending until ending with 1."
That was all we were given, I have no idea where to even start. Can someone please lead me in the correct direction!
Thank you so much!!
Countdown script
Moderator: DosItHelp
thepierre,
Here is a hint:
Callup the help for the FOR command and read.
From command line run: FOR /?
or click here http://www.dostips.com/DosCommandIndex.htm#FOR
DosItHelp?
Here is a hint:
Callup the help for the FOR command and read.
From command line run: FOR /?
or click here http://www.dostips.com/DosCommandIndex.htm#FOR
DosItHelp?
I see what it is talking about, I am just not getting the variable part... and how do I know what command to run. That did help though!
I just don't understand how to form it so that it will display the numbers to the screen, here is what I have:
FOR /L %variable IN (49,-2,1) DO command
I start at 49, it is counting down by 2, so I get my odd numbers, and it ends at 1.
I just don't get what the variable is, or what the command is.
I just don't understand how to form it so that it will display the numbers to the screen, here is what I have:
FOR /L %variable IN (49,-2,1) DO command
I start at 49, it is counting down by 2, so I get my odd numbers, and it ends at 1.
I just don't get what the variable is, or what the command is.
More hints for you:
FOR loop variables can only be one letter long
ECHO outputs a message on the screen, message can have variables in it.
http://www.dostips.com/DosCommandIndex.htm#ECHO
Make sure you post your solution here
FOR loop variables can only be one letter long
ECHO outputs a message on the screen, message can have variables in it.
http://www.dostips.com/DosCommandIndex.htm#ECHO
Make sure you post your solution here