1.

Solve : windows xp and "choice"?

Answer»

Hi GUYS,

I'm just getting into this "dos" thing after a many years of managing WITHOUT it or just scratching the surface, a friend of mine DEMONSTRATED a few things that could be done within a dos command and he got me INTERESTED enough to start using them both personaly and out "in the field".

I have just spent the weekend playing with some commands and have managed to create a handful of single click bat files that will backup documents and folders from my machine to another machine on my network. I'm just toying with the idea of creating a new file that will give me maybe 7 or 8 options of bat files to run as opposed to clicking them individualy, but i'm having problems understanding the "choice / Set" command.......I just dont see whats wrong...

I'm thinking along the lines of:

choice 1 .... run bat file 1
choice 2 .... run bat file 2
..... etc
choice 6 .... run all bat files and shutdown pc

I hope you see what i'm trying to do here, its the only problem i have not been able to work out yet.... everything else seems logical.

Thankyou in advance for your replies / help / advice

CHOICE was not included with WinXP, but the expanded version of SET was. CHOICE only offered 1 byte choices whereas SET has more possibilities.

Example:

Code: [Select]
@echo off
set /p var=Enter day of week:
if /i %var%=mon call batch1
if /i %var%=tue call batch2
if /i %var%=wed call batch3
.
.
if /i %var%=fri call batch1 & call batch2 & call batch3 & call batch4 & call batch5 & shutdown -s -t 15


Instead of getting into the batch thing, a better choice would be Windows Script

Hope this helps. D'oh.................... :-/

I was just getting into dos, and someone gets me to try something else...................

Hey thanks.... i got the "choice" thingy sorted, yes it was "set" instead. I also managed to do a multiple choice file........

I'll now go and try windows script thingy.........



Discussion

No Comment Found