Batch Files Are Gay

13 public posts in this discussion.

Post 1

OMG im doing this batch file assigment for my uni. and its made up of 4 files but i cant even the the first to work proberly casue if i try move it or rename it it dosnt work. tehre such a pain in the ass.

This is the code.
Quote:

@ECHO OFF
REM Written by Craig Rachow

:mainMENU
CLS
ECHO 1. Applications
ECHO 2. Utilities
ECHO 3. Games
ECHO 4. Quit
ECHO.
CHOICE /C:1234 /N Please enter a choice[1,2,3,4] :
IF ERRORLEVEL == 4 GOTO END
IF ERRORLEVEL == 3 GOTO gamesMENU
IF ERRORLEVEL == 2 GOTO utilsMENU
IF ERRORLEVEL == 1 GOTO appsMENU
:gamesMENU
CALL GAMES.BAT
GOTO mainMENU
:utilsMENU
CALL UTILS.BAT
GOTO mainMENU
:appsMENU
CALL APPS.BAT
GOTO mainMENU
:END

:Utilities
call Utilities.bat
goto begin

:Games
call Games.bat
goto begin

:End
cls

Why wont it work?

Post 2

I couldnt get the CHOICE command to trigger, but here is a web page that has all the commands. According to all the places you have it correct.

http://www.easydos.com/dosindex.html

Could it have anything to do with the version on the computer? Im running Win XP but who knows what commands work in its version of DOS.

That was a good waste of an hour or two. :D

Post 3

heya, msg me on MSN, i fixed ure prob

Post 4

k, well i almost fixed it,
basically windows xp doesnt have 'CHOICE.bat'
so you have to use

set /p userchoice=/n /c:1234 Please enter a choice[1,2,3,4]?

instead, but now the only prob is making it not display the stupid line, only the wanted text!!... Grrrr

Post 5

Woohoo! I thought I was doing some major thing wrong. lol

Post 6

no such thing as choice.bat. it was a dos command, not another batch file.

if you want to stop a line displaying in dos, prepend it with an @ sign.

eg, @set /p .....

or, as in knights example, begin the batch file with @echo off
to disable echoing completely.

also, i think i just figured out what you were really asking, when using the set method, the /n /c:1234 is not necessary. you will need to do some form of error checking on the input to make sure its within the range you want it to be in.

Post 7

yeah, my bad... choice.com i mean

oh cool really? So how do we finish it? I mean get the WHOLE package working?

Post 8

i did this last year... was fun... it was also good cause the teacher opened one up that 3 of us made and it opened up every program on his computer and shut it down :)

bobs cool

Post 9

not choice.com either :) its an internal dos command just like 'dir' or 'cd', no physical files exist for it, its part of command.com itself.

using 'set /p choice....' won't set an errorlevel, but it will set the value of an environment variable called %choice%

Post 10

can't use choice in a .bat file in the root directory of a drive in windows XP.

So if you are running it from root try move it to a directory. I had ALOT of problems with that.

Post 11

you can't use choice in a batch file in windows xp period. it doesn't exist, it is no longer a valid command in the xp command interpreter.

the set /p method is the correct way to do this under windows xp.

Post 12

Well good news people I got it to run like a 4 legged dog
So im all happy
I’m not gonna post it cause 3vil will properly tax it and I want him to do it him self and suffer the frustration like I did :P

Post 13

lol **** you i've done like @echo and have like not idea what to do.

go go exile for help when he talks to me

ahh criag you need two level's of menu's.