有没有办法启动一个程序最小化与VBScript使用WScript.Shell? [英] Is there a way to start a program minimized with VBScript using WScript.Shell?

查看:391
本文介绍了有没有办法启动一个程序最小化与VBScript使用WScript.Shell?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是我现在启动应用程序的一些示例代码:

Here is some example code I have right now to launch an app:

Set objShell = Wscript.CreateObject("WScript.Shell")     
objShell.Run """C:\Program Files\Handbrake\HandBrakeCLI.exe"""

我试过下面的启动应用程序最小化,但它没有工作。我假设这只能从正常的命令提示符下工作。

I tried the following to launch the app minimized but it didn't work. I'm assuming this only works from a normal command prompt?

Set objShell = Wscript.CreateObject("WScript.Shell")     
objShell.Run "start /MIN ""C:\Program Files\Handbrake\HandBrakeCLI.exe"""

我也试过启动一个快捷方式(只是给了一个null错误,脚本无法运行)以及尝试做一个 sendkeys 以最小化它没有工作。

I've also tried launching a shortcut (which just gave a null error and the script couldn't run) as well as trying to do a sendkeys to minimize it which didn't work at all.

这是来自通过cscript.exe运行的VBScript。

This is from a VBScript running via cscript.exe by the way.

有人知道我可以启动这个应用程序在VBScript最小化?

Does anyone know how I can start this app minimized within VBScript?

推荐答案

检查文档并使用.Run方法的第二个参数。

Check the docs and use the second parameter of the .Run method.

证据: / p>

Evidence:

set s = createobject("WScript.Shell")
s.run "notepad", 2

启动记事本最小化。

这篇关于有没有办法启动一个程序最小化与VBScript使用WScript.Shell?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆