Help Needed with VBScripting
Hi All
I am looking to put a VBScript into a few of my virtual applications that will look for an exe on a server and if it finds it then it needs to run the exe, but if it cant find it then it needs to launch the app anyway. Any help would be greatly appreciated.
thanks
I am looking to put a VBScript into a few of my virtual applications that will look for an exe on a server and if it finds it then it needs to run the exe, but if it cant find it then it needs to launch the app anyway. Any help would be greatly appreciated.
thanks
0 Comments
[ + ] Show comments
Answers (4)
Please log in to answer
Posted by:
Jsaylor
15 years ago
Here's the bones of the logic you're looking for.
This may be presumptuous, but I assume you already know how to set up a shell object to run whatever commands it is you're going to be running. This is just the If/Then to look for a file and then do something.
Set objfso = wscript.createobject("scripting.filesystemobject")
if objfso.fileexists("\\SERVER\SHARE\FILE.EXT") Then
' Do Something here
Else
' Do Something Else here
End If
This may be presumptuous, but I assume you already know how to set up a shell object to run whatever commands it is you're going to be running. This is just the If/Then to look for a file and then do something.
Posted by:
bkruiser
15 years ago
Earthworm,
It would be valuable for you to attempting doing some basic searches and attempting to write a script before posting.
You want to see if a file"exists" then "run" that executable, else "run" the app anyway.
Focus on each part of the script and make something that does each part. (Exist & objShell.Run) - almost made you find the objShell part of that.
Then mash them together.
Go to the microsoft scripting guys web page and download the portable script center, where you can search for important terms, and build a script around that.
Good luck,
Brian
It would be valuable for you to attempting doing some basic searches and attempting to write a script before posting.
You want to see if a file"exists" then "run" that executable, else "run" the app anyway.
Focus on each part of the script and make something that does each part. (Exist & objShell.Run) - almost made you find the objShell part of that.
Then mash them together.
Go to the microsoft scripting guys web page and download the portable script center, where you can search for important terms, and build a script around that.
Good luck,
Brian
Posted by:
earthworm jim
15 years ago
Sorry J,
not sure what you mean by setting up a shell object?
I've got the whole find the file logic and can find it, but not sure how to tell it to launch the exe if it can find it. Also not to sure what the syntax is to say "If you cant find the file just do nothing and carry on launching the application" thats what I seem to be struggling on. Sorry to come across a dork but havent been doing scripting very long
not sure what you mean by setting up a shell object?
I've got the whole find the file logic and can find it, but not sure how to tell it to launch the exe if it can find it. Also not to sure what the syntax is to say "If you cant find the file just do nothing and carry on launching the application" thats what I seem to be struggling on. Sorry to come across a dork but havent been doing scripting very long
Posted by:
Jsaylor
15 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.