Board logo

标题: vbs中的文件名中有空格的问题 [打印本页]

作者: bjsh     时间: 2007-4-4 10:31    标题: vbs中的文件名中有空格的问题

set WshShell=WScript.CreatObject("WScript.Shell")
WshShell.Run("E:\program files\tencent\QQ\qq.exe")

为啥老提示说  系统找不到指定的文件

把e:\program files\tencent\qq  文件夹复制到 c:\下

WshShell.Run("c:\QQ\qq.exe")  就可以了?


是不是这个 Program files 文件夹中有空格的问题啊?怎么解决?
作者: baomaboy     时间: 2007-4-4 10:35
当路径中含有空格时:

①WshShell.Run("""E:\program files\tencent\QQ\qq.exe""")

②WshShell.Run(chr(34)&"E:\program files\tencent\QQ\qq.exe"&chr(34))

[ Last edited by baomaboy on 2007-4-4 at 10:44 AM ]
作者: bjsh     时间: 2007-4-4 10:40
感谢ls的明白了

[ Last edited by bjsh on 2007-4-3 at 09:42 PM ]