简体   繁体   English

如何使用多个命令启动cmd.exe / k?

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

Why doesn't the following code change the color and the title on cmd2 ? 为什么以下代码不能更改cmd2上的颜色和标题? How, and what to do? 怎么做,怎么做? The command changes color on cmd1 , and sets the title on cmd2 ? 该命令在cmd1上更改颜色,并在cmd2上设置标题?

start cmd.exe /k TITLE TEST & color 02 & mode con: cols=160 lines=78 
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. 在不引用新cmd实例必须执行的命令的情况下, &start后被解释为命令串联,因此它在第一个实例中执行。 With quotes, it is part of the command to execute in the second cmd instance. 使用引号,它是在第二个cmd实例中执行的命令的一部分。

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). 此外,由于start命令将第一个引用的参数视为要启动的窗口的tile,并且我们将使用引号,因此必须在命令中包含标题(或""表示没有标题)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM