maxthedork
MIS
There's a lot of really good scripters on this forum, so I'll put this question to you: Back in the DOS days I used the CHOICE command a lot. Since Win98 that command is no longer available in the Windows environment. So how could I write a batch file that would achieve the same result in Windows 2000/XP as the following code:
Also, is there a more elegant way to append to a text file than this (for example):
Where "sechosts.txt" contains the hosts entry I'd like to append to the existing hosts file for the Southeast Center.
One other (semi-)related question. I realize after seeing (and using in some cases) some of your batch file code, my batch-scripting skills are way outdated (mostly from pre-DOS 6.22 days). Is there any reference book you would suggest to bring my skillset up to date? Then I could stop asking these mundane questions here (-:
Thanks in advance!
Code:
echo.
echo 1. Southeast Center
echo 2. Downingtown
echo 3. Exton
echo 4. Malin Rd.
echo 5. Marple
echo.
choice /c:12345q Which campus? (q to quit)
if errorlevel 1 if not errorlevel 2 goto sec
if errorlevel 2 if not errorlevel 3 goto dow
if errorlevel 3 if not errorlevel 4 goto ext
if errorlevel 4 if not errorlevel 5 goto mal
if errorlevel 5 if not errorlevel 6 goto mar
if errorlevel 6 goto done
Also, is there a more elegant way to append to a text file than this (for example):
Code:
echo y | copy %systemroot%\system32\drivers\etc\hosts+sechosts.txt %systemroot%\system32\drivers\etc\hosts
Where "sechosts.txt" contains the hosts entry I'd like to append to the existing hosts file for the Southeast Center.
One other (semi-)related question. I realize after seeing (and using in some cases) some of your batch file code, my batch-scripting skills are way outdated (mostly from pre-DOS 6.22 days). Is there any reference book you would suggest to bring my skillset up to date? Then I could stop asking these mundane questions here (-:
Thanks in advance!