从 vbscript 启动程序 [英] Launch program from vbscript

查看:30
本文介绍了从 vbscript 启动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 vbscript 启动一个名为 WebDrive 的程序,但我无法获得正确的语法以使用多个参数启动该程序;当前从批处理文件运行:

I am trying to launch a program called WebDrive from a vbscript but I cant get the syntax right to launch the program with a number of parameters; currently run from a batch file:

start /wait /D "c:\program files\webdrive" webdrive.exe /s:"syd-ftp.thruinc.net"

我的基本代码是:

Set objShell = CreateObject("cscript.Shell")
objShell.Run start /wait /D c:\program files\webdrive webdrive.exe /s:"syd-ftp.thruinc.net"""
Set objShell = Nothing

我在本网站上阅读了许多与此主题相关的帖子,但似乎无法正确引用,例如:

I have read a number of posts on this site relating to this topic but I cant seem to get the quotes right, for example:

Set objShell = CreateObject("cscript.Shell")
objShell.Run "start /wait /D ""c:\program files\webdrive"" webdrive.exe /s:"""syd-ftp.thruinc.net"""
Set objShell = Nothing

任何建议都会很棒.

问候

马丁

推荐答案

objShell.Run "start /wait /D ""c:\program files\webdrive"" webdrive.exe /s:"""syd-ftp.thruinc.net"""
                                                                           ^

删除这里的双引号之一!

Remove one of the double quote here!

你可以先echo out命令来检查它是否在正确的引用中

You can echo out the command first to check whether it is in correct quote or not

Set objShell = CreateObject("WScript.Shell")
'WScript.Echo "start /wait /D ""c:\program files\webdrive"" webdrive.exe /s:""syd-ftp.thruinc.net"""
objShell.Run "start /wait /D ""c:\program files\webdrive"" webdrive.exe /s:""syd-ftp.thruinc.net"""
Set objShell = Nothing

我使用 WScript.Shell 来创建 objShell 而不是 cscript.shell.好像没问题.

I use WScript.Shell to create objShell instead of cscript.shell. It seems ok.

这篇关于从 vbscript 启动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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