简体   繁体   English

如何运行Inno Setup中隐藏的cmd.exe

[英]How to run cmd.exe hidden in Inno Setup

I was wondering if there was any way to run the command prompt from Inno Setup's Exec function in a way which would hide the output from the user. 我想知道是否有任何方式可以从Inno Setup的Exec函数中运行命令提示符,而这会隐藏用户的输出。 Currently I have the below function which I'd like to do this for. 目前,我有以下功能,我想这样做。

Exec(
    'cmd.exe',
    '/c ' + InstallPath + '\initdb ' + '-U postgres -A password -E utf8 --pwfile=' +
        InstallPath + '\password.txt -D ' + DataPath,
    '', SW_SHOW, ewWaitUntilTerminated, ResultCode);

I know you can add a flag to the Run section, but haven't really found anything analogous to that. 我知道您可以在Run部分添加一个标志,但实际上并没有找到类似的标志。 Any help would be appreciated. 任何帮助,将不胜感激。

You should be able to change the SW_SHOW to SW_HIDE to hide the command window. 您应该能够将SW_SHOW更改为SW_HIDE以隐藏命令窗口。

For example: 例如:

Exec(
    'cmd.exe',
    '/c ' + InstallPath + '\initdb ' + '-U postgres -A password -E utf8 --pwfile=' +
        InstallPath + '\password.txt -D ' + DataPath,
    '', SW_HIDE, ewWaitUntilTerminated, ResultCode);

For those using [Run] section, see How to run a CMD command without openning a new window in Inno Setup . 对于使用[Run] ,请参阅Inno Setup中如何在不打开新窗口的情况下运行CMD命令

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM