如何在vbscript中静默运行exe

时间:2020-06-13 15:54:53

标签: vbscript

我制作了一个执行EXE的脚本,该脚本改变了笔记本电脑的风扇速度。但是在启动时,我会看到烦人的控制台弹出窗口,如何使它消失?

vbscript:

Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "DellFanCmd", "ec-disable-nofanchg", "", "runas", 1
objShell.ShellExecute "DellFanCmd", "fan1-level1", "", "runas", 1

谢谢

1 个答案:

答案 0 :(得分:2)

请参阅ShellExecute method

语法

.ShellExecute "application", "parameters", "dir", "verb", window
.ShellExecute 'some program.exe', '"some parameters with spaces"', , "runas", 1

密钥

application   The file to execute (required)
parameters    Arguments for the executable
dir           Working directory
verb          The operation to execute (runas/open/edit/print)
window        View mode application window (normal=1, hide=0, 2=Min, 3=max, 4=restore, 5=current, 7=min/inactive, 10=default)

因此,可以通过将1更改为0

来编写您的代码,如下所示
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "DellFanCmd", "ec-disable-nofanchg", "", "runas", 0
objShell.ShellExecute "DellFanCmd", "fan1-level1", "", "runas", 0
相关问题