Page 1 of 1

Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?

Posted: 21 May 2024 04:32
by PiotrMP006
Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?

Image

Please help

Re: Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?

Posted: 21 May 2024 04:47
by miskox
Do this at the command prompt:

Code: Select all

title test
dir
pause
set /p "somestr=enter something:" 
You will see that 'pause' is added to the title or complete 'set /p' command is added to the title. Looks like this is just how 'title' command works - adds a command that stops the processing of the batch file.

Maybe anyone else has a better explanation.

Saso

Re: Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?

Posted: 21 May 2024 05:16
by PiotrMP006
Must be in one line of code

Re: Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?

Posted: 21 May 2024 08:35
by kwsiebert
It has nothing to do with the title command. The currently executing command is always added to the window title, until it completes, and the pause command is running until you press a key. You can see this by opening a fresh command prompt and executing the pause command by itself.