Question

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!

Was it helpful?

Solution 3

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.

OTHER TIPS

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

An easy way to do it is:

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

This works if nothing is entered.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top