vb script to install app after checking for a file
Posted on 2006-06-08
I am trying to put together a script bundled from different web sources which will checkfor the existance of a file and run an executable if it does NOT exist.
What this is doing is supposed to do is checking for the existance of a driver file in c:\program files and if it is not there running the exe.
I get an error and am not sure what.
' this script will check for the existance of a file and run an app if it is not found.
' These values are just for example and testing... substitute your own real values here.
LogFile = "C:\program files\cups driver\cups6.inf"
TxtFile = "C:\program files\cups driver\cups6.ini"
AppToRun = "\\10.10.10.1\Applications\Cups Driver\Cups driver discovery PDF.exe"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WSH = CreateObject("Wscript.Shell")
' If target file doesn't exist, install app.
If Not FSO.FileExists(TxtFile) Then
Wscript.Echo "File does not exist."
' see if we need to create inf file...
If FSO.FileExists(LogFile) Then
Wscript.Echo "Aborting... application is installed."
' If we get this far then we can run the application...
Wscript.Echo "File does exist."
Set Running = WSH.Exec(AppToRun)
The exe in question installs the driver files