user1580348
user1580348

Reputation: 6053

Show a "title" in the cmd.exe title-bar from a batch file?

According to the Microsoft Documentation, this is the syntax of the Start command:

start ["<Title>"] [/d <Path>] [/i] [{/min | /max}] [{/separate | /shared}] [{/low | /normal | /high | /realtime | /abovenormal | belownormal}] [/affinity <HexAffinity>] [/wait] [/b {<Command> | <Program>} [<Parameters>]]

So I created a batch file "test.bat" with this content:

START "My test" /WAIT notepad

...to supposedly have the cmd.exe console window showing the title "My test" in the title-bar.

However, when executing this .BAT file, the title "My test" is not displayed in the title bar of the console window:

enter image description here

So I tried this command in the .BAT file:

START title "My test" /WAIT notepad

However, when executing this .BAT file, the whole command line was displayed in the title-bar of the console window:

enter image description here

...and notepad was not started.

So how can I display only the "title" in the title-bar of the console window and have the command executed?

OS: Windows 7 x64 SP1

Upvotes: 5

Views: 11540

Answers (2)

Debola Louis
Debola Louis

Reputation: 1

Title "Your needed title should be typed here without quote"
START "" /WAIT notepad

// The two quotes after the start command may also have title within it but this will only reflect in the new window which the Start command is expected to start which will then lunch the notepad.

However, for the current window, the first line Title bla... bla...bla.. is what is required.

Upvotes: 0

Dwad
Dwad

Reputation: 185

The title command changes inside the window, just put title command in the actual file, or if you want some kind of launcher (I don't know why you would want this) then have a bat using call to call the other bat (The one that would have the title command inside it)

EDIT: I found the answer, if you're starting a program (with the command start "foo\bar\some spaces\path\yourbat.bat) then the start command automatically interperets foo\bar\some spaces\path\yourbat.bat to be the title, too, but if you call start "title" "foo\bar\some spaces\path\yourbat.bat" then it will run your file AND interpret the first quotation marks to be the title, and the second the path

Upvotes: 5

Related Questions