echo (message): echo meesage
set /p VarName=Message: variable prompt; message: Message, variable: VarName
help (command): how to use command
( :
commands : execute commands
) :
if (test) (command): execute command if test is true
:labelName : label named labelName
goto (label): go to label
%VarName%: Read VarName
color (hex): set color to hex
echo.: echo a blank line
ren <old name> <new name>: rename <old name> to <new name>
del <file>: delete <file>
title <text>: sets title to text
------------------------------------------------------------
Don't get something? Reply to this post.
Last edited by ThePCKid (2011-05-21 13:19:33)
Offline
this was for me, wasnt it
Offline
TornFusion wrote:
this was for me, wasnt it
I thought of others, too.
Offline
SeptimusHeap wrote:
set /p (var) = Question
if "%(var)%"=="Answer" (
)
The equals sign has to be connected. Also, variable names are not enclosed in quotes and percent signs. Also, variable names cannot contain parentheses.
Fixed code:
set /p var="Question " if %var%==Answer ( )
It's good to enclose the prompt in between quotes and add a space. You could also do a line break in between Question and the prompt:
echo Question set /p var= if %var%==Answer ( )
Also, if you are only doing one command in a if statement, it's good practice to not use parentheses.
Offline
ThePCKid wrote:
SeptimusHeap wrote:
set /p (var) = Question
if "%(var)%"=="Answer" (
)The equals sign has to be connected. Also, variable names are not enclosed in quotes and percent signs. Also, variable names cannot contain parentheses.
Fixed code:Code:
set /p var="Question " if %var%==Answer ( )It's good to enclose the prompt in between quotes and add a space. You could also do a line break in between Question and the prompt:
Code:
echo Question set /p var= if %var%==Answer ( )Also, if you are only doing one command in a if statement, it's good practice to not use parentheses.
Uum...
if "%var%"=="Answer" works.
Offline
SeptimusHeap wrote:
ThePCKid wrote:
SeptimusHeap wrote:
set /p (var) = Question
if "%(var)%"=="Answer" (
)The equals sign has to be connected. Also, variable names are not enclosed in quotes and percent signs. Also, variable names cannot contain parentheses.
Fixed code:Code:
set /p var="Question " if %var%==Answer ( )It's good to enclose the prompt in between quotes and add a space. You could also do a line break in between Question and the prompt:
Code:
echo Question set /p var= if %var%==Answer ( )Also, if you are only doing one command in a if statement, it's good practice to not use parentheses.
Uum...
if "%var%"=="Answer" works.
Oh. I didn't know that.
Offline