Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?
Please help
Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?
-
- Posts: 20
- Joined: 2021-Sep-01, 10:57 am
- Simon Sheppard
- Posts: 196
- Joined: 2021-Jul-10, 7:46 pm
- Contact:
Re: Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?
While the session is paused, the text "- pause" will be appended to the window TITLE.
The only way I can think to prevent that would be setting a TITLE with lots of spaces at the end, up to the maximum length of 243 or 259 characters long. Then the additional "- pause" text will not be displayed.
There is a non-zero chance this might create some kind of overflow condition, but it seems to work in a quick test.
The only way I can think to prevent that would be setting a TITLE with lots of spaces at the end, up to the maximum length of 243 or 259 characters long. Then the additional "- pause" text will not be displayed.
There is a non-zero chance this might create some kind of overflow condition, but it seems to work in a quick test.
Re: Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?
You could use
Code: Select all
pause 2>nul | title Test
- Simon Sheppard
- Posts: 196
- Joined: 2021-Jul-10, 7:46 pm
- Contact:
Re: Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?
Interesting, just piping pause to title throws the error "The process tried to write to a nonexistent pipe"
but if you redirect stdout to Nul, there is no error:
but if you redirect stdout to Nul, there is no error:
Code: Select all
pause >nul | title
Re: Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?
But it's pretty obvious that there's nothing left that could be written to the pipe if you redirect the output to nul.Simon Sheppard wrote: ↑2024-May-30, 4:56 pm Interesting, just piping pause to title throws the error "The process tried to write to a nonexistent pipe"
but if you redirect stdout to Nul, there is no error:
- Simon Sheppard
- Posts: 196
- Joined: 2021-Jul-10, 7:46 pm
- Contact:
Re: Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?
Yes, so I think its better to use >nul rather than 2>nul which just hides the error, but I'm still puzzled why the error in the first place - where did the pipe go?
Perhaps it is just because Title does not accept piped input.
Perhaps it is just because Title does not accept piped input.
Re: Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?
You are right, it seems better to use > NUL.
The title command ends shortly after the title is set, but the pause only generates the output when the user presses a key.Simon Sheppard wrote: ↑2024-May-31, 8:12 am but I'm still puzzled why the error in the first place - where did the pipe go?
-
- Posts: 37
- Joined: 2021-Dec-13, 3:53 pm
Re: Why does "(title Test) & pause" change the window title to "Test - pause" and not to "Test"?
If you add something like echo, then it works fine:
Code: Select all
title Test & echo & pause