1

Okay, so I am currently trying to write a program in Batch and I want to be able to program the ENTER key to be the button without just simply typing pause or pause>nul because that will let any key work and i don't want that as an option.

This is what it would normally look like:

set /p continue= if %continue% == [ENTER KEY GOES HERE] goto start

Where I have typed [ENTER KEY GOES HERE] is where I obviously want to put the Enter key option to proceed, but I don't know how to do that considering it doesn't to be as simple as

echo Press 'C' to continue... set /p continue= if %continue% == C goto start

If anyone has any ideas, PLEASE tell me, I would greatly appreciate it!

benimen16
  • 186
  • 1
  • 10
  • is this what u are looking for http://stackoverflow.com/questions/17038282/press-keyboard-keys-using-a-batch-file, it sure seems like it based on your description. – Anantha Sharma Apr 15 '14 at 23:29

3 Answers3

2

This will do it: it firstly clears the variable and if enter alone is pressed then it will remain empty.

set "continue="
set /p continue=
if not defined continue goto start
foxidrive
  • 40,353
  • 10
  • 53
  • 68
2

An easy way to do it is:

set /p continue=
if [%continue%]==[] goto start

This works if nothing is entered.

Behavior
  • 180
  • 11
1

I would simply ask for some input, as in:

set /p Var1="Press [ENTER] key to continue."

The user will have to press enter to continue.

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501