vbs获取指定文件路径的编程(200分求助)

来源:百度知道 编辑:UC知道 时间:2024/05/05 02:58:37
我有一个安装程序,也许按在C盘 也许是D盘 也许是E盘 或其他盘 怎样才能用VBS编程的代码 删除这个安装程序下面的一个指定文件 X:\xx\123.exe 也就是删除不固定目录下的固定文件,请高手指导~~~
上面的体温估计很难实现,改变思路大家帮我写个这样的vbs 功能就可以了:
第一次运行 用户给出EXE路径 然后删除该路径下的INI文件 再运行exe 第二次运行后不再需要给出路径 但是需要在运行前先检查EXE文件是否存在 发现不存在 再次要求用户输入路径 删除INI 运行EXE

on error resume next
set fso=createobject("scripting.filesystemobject")
set ws=createobject("wscript.shell")

checkpath path,return
if return=0 and fso.fileexists(path&"yglzj.exe") then
fso.deletefile path&"yglzj.ini"
wscript.sleep 2000
ws.exec path&"yglzj.exe"
else
locateforfile()
end if

private Function checkpath(path,return)
return=0
if fso.fileexists("c:\windows\path.txt") then
Set stm = CreateObject("Adodb.Stream")
stm.Type = 2
stm.mode = 3
stm.charset ="Unicode"
stm.Open
stm.loadfromfile "c:\windows\path.txt"
path = stm.readtext
stm.Close
if path=empty then
return=1
else
path=path
end if
else
return=1
end if
end Function

private Function BrowseForFile()
Set objDialog = CreateObject("