Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I start cmd.exe /k with multiple commands?

Why doesn't the following code change the color and the title on cmd2? How, and what to do? The command changes color on cmd1, and sets the title on cmd2?

start cmd.exe /k TITLE TEST & color 02 & mode con: cols=160 lines=78 
like image 537
SectorSeven Avatar asked Oct 08 '15 19:10

SectorSeven


People also ask

Can you Run multiple commands in cmd?

You can run two commands in one line in Windows Command Prompt. For that, you need to create a batch script file using Notepad. Below, we have shared the two best methods to run multiple commands in CMD on Windows 10 computers. Let's check out.

What does K mean in Command Prompt?

Updated: 12/31/2020 by Computer Hope. Alternatively referred to as Cmd+K, Command+K is a keyboard shortcut that varies depending on the program used. For example, in certain programs, Command+K is used to insert a hyperlink, and in some browsers, Command+K focuses on the search bar.


1 Answers

start "TEST" cmd.exe /k "TITLE TEST & color 02 & mode con: cols=160 lines=78"

Without quoting the command that the new cmd instance must execute, the & is interpreted as a command concatenation after the start and so it is executed in the first instance. With quotes, it is part of the command to execute in the second cmd instance.

Also, as the start command sees the first quoted argument as the tile of the window to start, and we are going to use quotes, it is necessary to include a title in the command (or "" for no title).

like image 95
MC ND Avatar answered Oct 04 '22 10:10

MC ND