[英]How to run a CMD command without openning a new window in Inno Setup
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:我正在使用 Inno Setup 安装程序来设置一个安装程序文件,该文件可以调用我刚刚通过其脚本安装的 .exe,并在安装后立即使用以下命令启动它:
[Run]
Filename: "{cmd}"; Description: "{cm:LaunchProgram,3mtxmail}"; \
Flags: nowait postinstall skipifsilent runascurrentuser; \
Parameters: "/b /k "" ""{app}\my.exe"" -c ""{app}\default.conf"" "" "
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.当
my.exe
运行时,它不需要任何接口,只应侦听特定端口上的任何流量,并将该流量信息写入日志文件。
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.但是,当我执行安装程序并启动程序时,它仍然会弹出一个新的控制台窗口,我认为
/b
应该阻止它。 I expect not to see this new console window, and actually don't see anything on the screen.我希望不会看到这个新的控制台窗口,实际上在屏幕上也看不到任何东西。
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.从https://technet.microsoft.com/en-us/library/bb491005.aspx ,
/b
应该是指示不为命令打开新窗口的标志。
What is the correct syntax?什么是正确的语法?
It does not look like you need the cmd.exe
for anything.看起来您不需要
cmd.exe
来做任何事情。 Run your application directly instead:直接运行您的应用程序:
[Run]
Filename: "{app}\my.exe"; Parameters: "-c ""{app}\default.conf""" \
Description: "{cm:LaunchProgram,3mtxmail}"; \
Flags: nowait postinstall skipifsilent runascurrentuser;
Though if your application is a console application, it will open its own console.但是,如果您的应用程序是控制台应用程序,它将打开自己的控制台。 To prevent that, add
runhidden
flag .为了防止这种情况,添加
runhidden
flag 。
You can actually use the runhidden
flag to hide even the cmd.exe
console window.实际上,您甚至可以使用
runhidden
标志来隐藏cmd.exe
控制台窗口。 But if you have no need for the cmd.exe
, you should not use it.但是,如果您不需要
cmd.exe
,则不应使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.