windows 从具有自定义标题的快捷方式调用 cmd
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8574497/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
call cmd from shortcut with custom title
提问by eddyuk
i have a shortcut to cmd.exe.
我有一个 cmd.exe 的快捷方式。
Is it possible to change cmd window title when I run it from this shortcut ?
当我从这个快捷方式运行它时,是否可以更改 cmd 窗口标题?
回答by kev
C:\> cmd /k "title MyWindow"
`cmd /K` => Carries out the command specified by string but remains
`title [str]` => Specifies the title for the command prompt window.
回答by a_horse_with_no_name
I don't think this is possible. You will need to create a shortcut to a batch file that run cmd.exe with your custom window title, something like this:
我不认为这是可能的。您需要创建一个批处理文件的快捷方式,该文件运行带有自定义窗口标题的 cmd.exe,如下所示:
start "MyWindow" cmd.exe
回答by soren HJ
This works when launching from a CMD script (launches CMD in specific user context with a specific title)
这在从 CMD 脚本启动时有效(在具有特定标题的特定用户上下文中启动 CMD)
runas /savecred /user:domain\user "%SystemRoot%\system32\cmd.exe /K title BAD MF"