If you are writing a batch file and you don’t want to continue until somebody presses a key, you can do it really easy with the timeout command.
For instance, using the following on the command prompt will pause the terminal for 10 seconds unless you press a key:
Whereas this command will pause the terminal for 30 seconds whether you press a key or not:
And this one will pause forever until you press a key: