VB Script to run an exe

I need to create a vb script that will check for the existence of a file and if it is not found, run the install.
kim1109Asked:
Who is Participating?
 
kemi67Connect With a Mentor Commented:
Hello,
try this vbs code
 
dim objFSO 
dim strFile
dim strSetup
Dim shell

strFile="c:\yourpath\yourfile.exe"
strSetup="c:\yourpath\setup.exe"
Set objFSO = CreateObject("Scripting.FileSystemObject")
if not  objFSO.FileExists(strFile) then
    Set shell = CreateObject("WScript.Shell")
    shell.Run Chr(34) & strSetup & Chr(34), 1, false
    Set shell = Nothing
end if

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.