windows 如何静默运行批处理文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2705358/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:20:38  来源:igfitidea点击:

How can I run a batch file silently?

windowsbatch-filecommand-promptsilent

提问by Mike Pateras

I have a batch file with some commands that I need to run with my installer, but I'd rather a console not appear (in Windows). I'm executing the batch file from a WiX installer, via a custom action. I tried adding an @ECHO OFFto the top of the file, but that didn't seem to do anything.

我有一个批处理文件,其中包含一些我需要使用安装程序运行的命令,但我宁愿不显示控制台(在 Windows 中)。我正在通过自定义操作从 WiX 安装程序执行批处理文件。我尝试@ECHO OFF在文件顶部添加一个,但这似乎没有任何作用。

Is there a way that I can run this batch file silently?

有没有办法可以静默运行这个批处理文件?

回答by Svisstack

You can run it with stdoutout redirect to file eg. ./script > x.txt

您可以使用 stdoutout 重定向到文件来运行它,例如。 ./script > x.txt

回答by JRL

Create a shortcut to your batch file, then edit its properties, and select the run minimized option.

创建批处理文件的快捷方式,然后编辑其属性,并选择运行最小化选项。