显示"标题"在批处理文件的cmd.exe标题栏中?

时间:2017-12-03 17:25:43

标签: batch-file cmd

根据Microsoft Documentation,这是Start命令的语法:

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

所以我创建了一个批处理文件&#34; test.bat&#34;有了这个内容:

START "My test" /WAIT notepad

...应该有 cmd.exe 控制台窗口显示标题&#34;我的测试&#34;在标题栏中。

但是,在执行此.BAT文件时,标题为&#34;我的测试&#34;不会显示在控制台窗口的标题栏中:

enter image description here

所以我在.BAT文件中尝试了这个命令:

START title "My test" /WAIT notepad

但是,执行此.BAT文件时,整个命令行显示在控制台窗口的标题栏中:

enter image description here

......记事本没有开始。

那我怎么才能只显示&#34;标题&#34;在控制台窗口的标题栏中执行命令?

操作系统:Windows 7 x64 SP1

2 个答案:

答案 0 :(得分:1)

title命令在窗口内更改,只需将title命令放在实际文件中,或者如果你想要某种启动器(我不知道为什么你会想要这个)然后让一只蝙蝠使用call来调用另一只蝙蝠(其中包含title命令的蝙蝠)

编辑:我找到答案,如果您正在启动程序(使用命令start "foo\bar\some spaces\path\yourbat.bat),则start命令会自动进行foo\bar\some spaces\path\yourbat.bat也是标题,但是如果你打电话给start "title" "foo\bar\some spaces\path\yourbat.bat"那么它将运行你的文件并将第一个引号解释为标题,第二个引用为路径

答案 1 :(得分:0)

标题“您需要的标题应在此处输入,不带引号”

开始 "" /WAIT 记事本

// start 命令后面的两个引号内也可能有倾斜,但这只会反映在新窗口中,Start 命令预计将启动,然后在记事本中提供午餐。

但是,对于当前窗口,第一行 Title bla... bla...bla.. 是必需的。