首页 > 解决方案 > 如何在 vbscript 中静默运行 exe

问题描述

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

脚本:

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

谢谢

标签: vbscript

解决方案


参考ShellExecute 方法

句法

.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

推荐阅读