user2507295
user2507295

Reputation: 159

Changing Pause Message

Ok, so you know how when you type up pause in CMD, it will say 'Press any key to continue...'. How do I change that to say something like 'Press a key to proceed...'?

Lastly, I was coding a batch file. I want to know what's up if I have something like:

@echo off
cls
pause
pause
pause
pause

It seems to skip round about to pauses When you press a key. I'm curious as to know the rules of which the pauses are skipped. Thanks.

Upvotes: 6

Views: 11949

Answers (6)

K J
K J

Reputation: 11728

A more personalised version could be

@color 04&timeout -1|set /p="Hello %userprofile:~9%, you may press a key to proceed..."&color

And you can mix that with a continuation

enter image description here

@color 04&echo/&timeout -1|set /p="Hello %userprofile:~9%, you may press a key to proceed..."&color&echo  Continuing with process...

Upvotes: 0

code-me
code-me

Reputation: 11

Option #1:

@echo off

echo Press any key to continue or Ctrl-C to abort.

pause > nul

Option #2

set /p=Press any key to continue or Ctrl-C to abort.

-->> I prefer the screen output of option #1.

Upvotes: 1

code-me
code-me

Reputation: 11

This is one practical application:

set /p=Press ENTER key to proceed or Ctrl-C to abort.

Upvotes: 0

dbenham
dbenham

Reputation: 130819

Nearly the same as Deniz Zoeteman, except this version displays the blinking cursor on the same line as your custom message, as does the normal PAUSE command. The Deniz Zoeteman solution displays the blinking cursor below your message.

<nul set /p "=Press a key to proceed..."
pause >nul

Upvotes: 11

Deniz Zoeteman
Deniz Zoeteman

Reputation: 10111

You cannot change the text displayed when a pause command is executed. It's bound to the Windows installation's language pack. The only thing you can do is not letting it say anything by doing pause>nul. Of course, there's different ways to simulate pause; see the example from the other answer, where set /p is used. With pause>nul however, you can do this:

echo Custom pause message

pause>nul

And that should work.

And for pause commands skipping, that's most likely due to the key still being pressed down while the next pause command already executed (small guess though - I don't recall exactly if that's the behaviour of the command).

Upvotes: 7

R Dub
R Dub

Reputation: 688

You may want to try

set /p=your message

Note: you will have to hit the enter key to continue versus any key.

Upvotes: 1

Related Questions