如何在Inno Setup中运行CMD命令而不打开新窗口 [英] How to run a CMD command without openning a new window in Inno Setup

查看:1057
本文介绍了如何在Inno Setup中运行CMD命令而不打开新窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Inno Setup安装程序来设置安装程序文件,该文件可以调用我刚刚通过其脚本安装的.exe,并在安装后立即使用以下命令启动它:

I am using Inno Setup installer to setup an installer file, that can invoke the .exe that I just installed through its scripting, and launch it right after installation, with the following command:

[Run]
Filename: "{cmd}"; Description: "{cm:LaunchProgram,3mtxmail}"; \
    Flags: nowait postinstall skipifsilent runascurrentuser; \
    Parameters: "/b /k "" ""{app}\my.exe"" -c ""{app}\default.conf"" "" "

my.exe 运行时,不需要任何界面,并且只应侦听特定端口上的任何流量,并将该流量信息写入日志文件。

When my.exe is operating, it doesn't need any interface, and should only listen to any traffic on a specific port, and write that traffic info to a log file.

但是,当我执行安装程序并启动程序时,它仍然会弹出一个新的控制台窗口,我认为 / b 应该会阻止。我希望看不到这个新的控制台窗口,并且实际上在屏幕上什么也看不到。

However, when I execute the installer and launched the program, it still brings up a new console window, which I think the /b should have prevented. I expect not to see this new console window, and actually don't see anything on the screen.

来自 https://technet.microsoft.com/en-us/library/bb491005.aspx / b 应该是指示不要为该命令打开新窗口的标志。

From https://technet.microsoft.com/en-us/library/bb491005.aspx, the /b should be the flag that indicates not to open new windows for the command.

正确的语法是什么?

推荐答案

看起来似乎不需要 cmd.exe 。而是直接运行您的应用程序:

It does not look like you need the cmd.exe for anything. Run your application directly instead:

[Run]
Filename: "{app}\my.exe"; Parameters: "-c ""{app}\default.conf""" \
    Description: "{cm:LaunchProgram,3mtxmail}"; \
    Flags: nowait postinstall skipifsilent runascurrentuser; 






尽管您的应用程序是控制台应用程序,将打开自己的控制台。为防止这种情况,请添加 runhidden 标志

实际上,您可以使用 runhidden 标志来隐藏 cmd.exe 控制台窗口。但是,如果您不需要 cmd.exe ,则不要使用它。

You can actually use the runhidden flag to hide even the cmd.exe console window. But if you have no need for the cmd.exe, you should not use it.

这篇关于如何在Inno Setup中运行CMD命令而不打开新窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆