【发布时间】:2014-02-28 08:23:54
【问题描述】:
如果我在 Windows Scripting Host 环境中使用 VBScript,如何在字符串中插入双引号?
假设我要执行这一行:
notepad.exe "C:\Some Folder\foo.txt"
这行怎么写?我尝试了两种方法,但它给了我一个 expected identifier 错误。
WshShell.Run("%windir%\notepad.exe \"C:\Some Folder\foo.txt\"")
WshShell.Run("%windir%\notepad.exe ""C:\Some Folder\foo.txt""")
【问题讨论】:
-
您实际上是在使用硬编码路径,还是路径来自变量?我准确地选择了第二行并尝试运行它并启动记事本并尝试加载“C:\Some Folder\foo.txt”。我没有得到“预期的标识符”。
标签: vbscript wsh windows-scripting