Ori Zilber
Ori Zilber

Reputation: 1

cmd if script won't work

@echo off
pause
color 0a
mode 1000

set /p apps = where do you want to go to?
echo metrix = 1
echo nothing = 2
pause

if %apps% == 1 goto metrix
if %apps% == 2 goto nothing

:metrix
:start
echo %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random% %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random% %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%
goto start

:nothing
echo nothing
pause
exit

why doesnt it woerk?

I copied it from a tutorial and I have no idea why doesnt it work.

Upvotes: 0

Views: 105

Answers (2)

Andreas
Andreas

Reputation: 5599

Besides CuriousMind's suggestion you should also do the comparison this way:

if "%apps%"=="1" goto metrix
if "%apps%"=="2" goto nothing

Using quotes and removing redundant spaces is safer. You probably also want to write

echo metrix = 1
echo nothing = 2
set /p apps = where do you want to go to?

so that the echos are displayed before the question.

Upvotes: 0

CuriousMind
CuriousMind

Reputation: 3173

Remove the space before and after "=", in following statement.

set /p apps = where do you want to go to?

Upvotes: 1

Related Questions