We help IT Professionals succeed at work.

How to launch a program from a VBS file (500pts)

I have a batch file that I can double click to start a certain program. I want to advertise this program via GPO but since the program continues to run after it launches the logon script window never disappears with a batch file. I think launching the program from a VBS file will fix this.

This seems like it should be a really simple script. Basically I want to launch the program from %logonserver%/netlogon with some switches. So for example program.exe /switch1 /switch2 /switch3

Im not too good with VB scripting so looking for someone to help me out here.

Thanks
Comment
Watch Question

Set objShell = CreateObject("WScript.Shell")
objShell.Exec "wuauclt.exe /resetauthorization /detectnow"

look at this example
CERTIFIED EXPERT

Author

Commented:
Tried that when I run it on my local PC it works fine. When I set it to the logon script in the GPO it comes up with an error. Could not located the filepath where the executable is listed even though I know it is correct.
how are you reaching executable ? \\servername\drive\folder\    ?
Steve KnightIT Consultancy
CERTIFIED EXPERT

Commented:
Try running it from the batch file as

START "" "\\server\share\yourprog.exe /arg1 /arg2"

then it will pass control to the other program then continue to the next entry in the batch file without stopping.

etc.
CERTIFIED EXPERT

Author

Commented:
Tried that and I dont get any error messages but the program does not launch. No entries in the event viewer or anything.
The only difference between the script above and the second script we showed you is that we changed objShell.Run to objShell.Exec. Yet, when you run this script, it appears to do nothing. You don't even see a window quickly flash open. Instead you see nothing at all. Would you believe us if we told you that ipconfig was actually being run? Well, don't take our word for it, instead, add a redirection symbol (>), followed by a text file name after the call to ipconfig. That will cause the output of the command to be put in the file. If you're not used to redirection, think of it this way: if we're telling you the truth and ipconfig is running, then it is creating it's standard text display. Unfortunately, we can't see it. The redirection will allow us to capture any output and force it into a file. This will help us verify whether or not the ipconfig command is being run. This next script rounds up our output for us.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.