使用 objshell.run -- vbscript 时找不到文件 [英] File not found when using objshell.run -- vbscript

查看:25
本文介绍了使用 objshell.run -- vbscript 时找不到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行脚本时,它抛出文件不存在的错误..在脚本上,它确实回显文件存在.试过objshell.run """apppath""" 但没有运气.. :(请帮忙.

When i try to run the script it throws up error that the file does not exist.. On the script it does echos file exists though. Have tried with objshell.run """apppath""" but no luck.. :( Please help.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
AppPath =  objshell.ExpandEnvironmentStrings("%ProgramFiles%") + "\ERUNT\ERUNT.EXE"
wscript.echo apppath
if fx = objfso.FileExists("apppath") then
wscript.Echo "File Exists"
objshell.run apppath
Else
Wscript.echo "File Does not Exist"
end IF 

推荐答案

Apppath 包含空格.尝试用引号将其括起来.

Apppath contains spaces. Try surrounding it in quotes.

objshell.run vbQuote & apppath & vbQuote

这篇关于使用 objshell.run -- vbscript 时找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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