Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running apps

Status
Not open for further replies.

kettch

Programmer
Mar 5, 2001
110
US
i have a intranet site that uses links to installation files of programs to allow the quick running of the installation programs. However, one of the apps requires the use of command line switches to make sure it gets installed the way we want it. So the full path of the executable looks like this:

Code:
\\server\share\subfolder\WIN32\SETUP.EXE /s /v"/qb+ /mnavwnt"
What ever i do, i cannot seem to get it to work with just a regular hyperlink. It always just says page not found. I've even tried replacing the /'s and spaces with the special characters like %20 for space.

What i was wondering is if there is any way to embed this in a small vbscript app that would handle to execution and not let it get messed up by the html interpreter of the browser.
 
Hello, kettch.

Would the following work?

Dim cmdline
cmdline = "\\server\share\subfolder\WIN32\SETUP.EXE /s /v" & chr(34) & "/qb" & "+" & " /mnavmnt" & chr(34)

regards - tsuji

 
Well, I tried this and it worked:

I have a machine "doxie" with a share "shared" on it.

As a test I copied EDIT.COM to this share, then made the following VBScript in the same share, calling it "wrapper.vbs":
Code:
Dim WshShell, Result

Set WshShell = Wscript.CreateObject("Wscript.Shell")
Result = WshShell.Run( _
  "\\doxie\shared\edit /b /r x.txt", 1, True)
MsgBox "Returned: " & CStr(Result)

Then I started a copy of IE, and in the Address Bar typed:

Code:
\\doxie\shared\wrapper.vbs

... and hit "enter."

It fired up Edit in B&W mode (/b), read-only mode (/r), with the file x.txt (which doesn't actually exist, but who cares).

After exiting Edit, I got a MsgBox popup with the result (0).

Is this close to what you need?

You can call WshShell.Run without using the result if you don't care - just say:

Code:
WshShell.Run "
Code:
command string
Code:
"

... if you like. Also the optional parameters I used in the example can be left off. The "1" is for a normal application window, and needed to be there because of the last parameter. The last parameter was "True" and says to pause the script here until the program being run completes.

You need to do that in order to see the result (duh!).

As for quotes in the command string, just use the usual VBScript syntax:

Code:
"folder\prog.exe /x:""QWE"""

... for example, yields the string folder\prog.exe /x:"QWE".

Hope this helps!
 
Right now i have the following:

Code:
function installNAV()
	WshShell.Run "\\server\vphome\clt-inst\WIN32\SETUP.EXE /s /v""/qb+ /mnavwnt"""
end function

and then in the body tag i have onload="installNAV"
when i run the page nothing happens, when i run the script itself, it says error on line 2 column 72. column 72 is the space directly after the /qb+. any ideas?

Also, i'm afraid i don't know enough vbscript to be able to sort out what i don't need out of your example. I don't need anything about results. It just needs to run that command line.
 
kettch,

If you still do not get it, here is the line:

WshShell.Run "\\server\share\clt-inst\WIN32\SETUP.EXE /s /v" & chr(34) & "/qb" & "+" & " /mnavmnt" & chr(34)

regards - tsuji
 
hey, thanks! this is just the first time i've ever touched vbscript, and i'm still trying things out. I know it's similar to standard VisualBasic, but i just gotta drop into the "groove".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top