如何使用参数调用 Run() [英] How to call Run() with parameters
本文介绍了如何使用参数调用 Run()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 Windows Batch 中有这行代码
I've got this working line of code in Windows Batch
start "" /wait /i "C:Program FilesSandboxieStart.exe" /box:NetBeans /wait "C:Program FilesNetBeans 7.3in
etbeans64.exe"
我想通过 VBScript 运行它.但我不知道如何在里面有空格的参数中传递路径.
I would like to run it via VBScript. But I don't know how to pass the path in parameter which has a space inside.
我想出了这样的事情:
Set objShell = CreateObject("Wscript.Shell")
objShell.Run("C:Program FilesSandboxieStart.exe" /box:NetBeans /wait "C:Program FilesNetBeans 7.3in
etbeans64.exe"), 1, True
但是有一个错误:
预期:')'
推荐答案
在文字字符串中,单个双引号字符由两个双引号字符表示.因此,请尝试以下操作:
Within a literal string, a single double-quote character is represented by two double-quote characters. So try the following instead:
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run """C:Program FilesSandboxieStart.exe"" /box:NetBeans /wait ""C:Program FilesNetBeans 7.3in
etbeans64.exe""", 1, True
Set objShell = Nothing
这篇关于如何使用参数调用 Run()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文