我如何 运行 在 vbscript 中静默执行一个 exe

How do I run a exe silently in vbscript

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

vbscript:

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

谢谢

参考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