如何创建 .BAT 文件打开程序并阻止其打开新窗口?
所以我从 .bat 文件启动一个 consol 程序。我希望它作为一个进程运行但不显示任何窗口。这样的事该怎么办呢?
So I am starting a consol program from .bat file. I want it to run as a process but not showing any windows. How to do such thing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为带有“/B”选项的启动命令应该可以做到这一点...
无窗口:
最小化:
I think the start command with a '/B' option should do it ...
Windowless:
Minimized:
我不确定我是否理解您的意思:如果您从 .bat/.cmd 脚本运行控制台程序,该程序将使用现有控制台窗口,而不是创建新的控制台窗口。
我怀疑您真正要问的是如何防止资源管理器打开 .bat/.cmd 脚本本身的控制台窗口本身。没有内置的方法可以做到这一点(尽管正如 amir75 建议的那样,您可以通过最小化运行脚本来缓解它;不要直接运行脚本,而是创建它的快捷方式并编辑快捷方式的属性)。
或者,您可以通过 Paul Miner 和我编写的 silentbatch 程序 运行脚本。
I'm not sure if I understand what you mean: if you run a console program from a .bat/.cmd script, that program will use the existing console window, not create a new one.
I suspect what you're really asking is how to prevent Explorer from opening a console window for the .bat/.cmd script itself. There's no built-in way to do that (although as amir75 suggested, you can mitigate it by running the script minimized; instead of running the script directly, create a shortcut to it and edit the shortcut's properties).
Alternatively, you can run your script through the silentbatch program that Paul Miner and I wrote.