文件路径中有空格的 VBS [英] VBS with Space in File Path

查看:36
本文介绍了文件路径中有空格的 VBS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我所拥有的,如果我将 bat 移动到名称中没有空格的文件夹,则无法让 bat 运行.我的问题是实际的蝙蝠在一个有空格的文件夹中,所以我需要这个才能工作.

This is what I have and can not get the bat to run, if I move the bat to a folder without spaces in the name it works. My problem is that the actual bat is in a folder with spaces, so I need this to work.

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("%comspec% /K C:\Program Files\ping.bat"), 1, True

推荐答案

需要引用文件规范:

Run("%comspec% /K ""C:\Program Files\ping.bat""")

这篇关于文件路径中有空格的 VBS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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