Monday, June 9, 2014

Batch Lessons part 3

In this lesson I am going to teach you how to code an input box in batch.  To make the question you will have to do @echo Question here.  Then you will have to code an input box like this.  set /p inputname= .  Then input name can be any 1 word thing.  Then it will save the name that you put there as a variable.  Variables can be echoed like this.  @echo %hi%.  You can also make something like this where if the answer is yes it will do something.


@echo off
@echo Would you like to download this file? (yes / no)
set /p question=
If %question% EQU yes goto yes
If %question% EQU no goto no
:yes
@echo Hi
pause
exit
:no
@echo Hi
pause
exit


For the If's EQU stands for equals, GTR stands for greater than and LSS stands for less than.

No comments:

Post a Comment