ditheredtransparency
ditheredtransparency

Reputation: 585

Can I run a CMD command without a new line?

I am trying to run the pause command without it displaying Press any key to continue . . . AND without creating a new line? I tried out the method someone suggested for echoing text without a new line, but that didn't work for me.

pause>nul is as far as I've gotten, but that creates a new line.

Here's an example:

This is some sample text.

The script pauses until a key is pressed.

And then it processes the rest:

This is some sample text.Here is the rest.

Any help is appreciated.

Upvotes: 2

Views: 833

Answers (1)

SomethingDark
SomethingDark

Reputation: 14305

No, commands are built in to the cmd executable and their behavior can't be changed. You can however, simulate the command output with an echo (or a <nul set /p = in your case).

@echo off

REM Write the same message that pause prints, but do not include a newline
set /p "=Press any key to continue..." <nul

REM Pause without output
pause >nul

REM Prove that we're still on the same line
echo This is on the same line

Upvotes: 5

Related Questions