Vbs脚本检查文件夹是否存在,然后运行文件 [英] Vbs Script to check if a folder exist and then run a file

查看:499
本文介绍了Vbs脚本检查文件夹是否存在,然后运行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我是新来的,我需要一个脚本来检查是否存在文件夹,然后从该文件夹运行文件.如果不是,则应将ZIP文件解压缩到特定位置.预先感谢!

Hello I'm new here I need a script to check, if a folder exist and then run a file from the folder. If not, it should extract a ZIP file into a specific location. Thanks in advance!

推荐答案

'Objects
Set fso = CreateObject("Scripting.FileSystemObject")
Set shl = CreateObject("WScript.Shell")

path="C:\SomeFolderToExist\" 'path to folder    
exists = fso.FolderExists(path)

if (exists) then 
    program="myprog.exe" 'Program name to run
    shl.Run(path & program) 'Run a program
end if

对于解压缩,我只能告诉您以下内容:从中提取文件带有VBScript的ZIP文件

For unzipping, I can only tell you to see this: Extract files from ZIP file with VBScript

这篇关于Vbs脚本检查文件夹是否存在,然后运行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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