Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VB Script to run an exe

Posted on 2011-10-19
1
Medium Priority
?
116 Views
Last Modified: 2012-10-15
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.
0
Comment
Question by:kim1109
1 Comment
 
LVL 7

Accepted Solution

by:
kemi67 earned 750 total points
ID: 36993949
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month20 days, 19 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question