VBScript to run application on local machine via HTA

Hi All,

I'm trying to create an HTA app that will launch an application on a local machine.  I'm having problems, probably with syntax, getting the objShell.run part to work.

I can paset this part "C:\WINDOWS\system32\java.exe -jar "C:\Program Files\EDS\AvLaunch.jar" IMAGEVIEWER.JHMI.COM --type ARS --port 80  --protocol HTTP" into a Start --> Run dialogue and it works.

Thanks.


<html>
<head>
<title>UV Start</title>
 
<HTA:APPLICATION 
     ID="UVHTA"
     APPLICATIONNAME="UVHTA"
     SCROLL="no"
	 SCROLLFLAT="yes"
     SINGLEINSTANCE="yes"
	 icon="http://help.jhmi.com/favicon.ico" 
	 CAPTION="yes"
	 SysMenu="Yes"
	 ShowInTaskbar="yes"
	 BORDER="thin"
	 BORDERSTYLE="normal"
	 SELECTION = "yes"
	 maximizeButton="no"
	 minimizeButton="no"
	 WINDOWSTATE="normal" 
 
>
<SCRIPT LANGUAGE="VBScript">
 
    Sub Window_onLoad
	    window.moveTo 15,15
        window.resizeTo 300,250
    End Sub 
</script>
 
<SCRIPT LANGUAGE="VBScript">
Sub RunScript
	Set objShell = CreateObject("Wscript.Shell")
	objShell.Run "C:\WINDOWS\system32\java.exe -jar "C:\Program Files\EDS\AvLaunch.jar" IMAGEVIEWER.JHMI.COM --type ARS --port 80  --protocol HTTP"
End Sub
</script>
 
 
</head>
 
 
<body STYLE="font:14 pt arial; color:white;
 filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000000', EndColorStr='#0000FF')">
 
 <table width="100%" border=1>
  <tr>
    <td width="50%" valign="top"><input id=runbutton  class="button" type="button" value="Launch" name="run_button"  onClick="RunScript"></td>
    <td width="50%" valign="top">Name</td>
  </tr>
</table
 
</body>
</html>

Open in new window

jhradAsked:
Who is Participating?
 
RobSampsonConnect With a Mentor Commented:
Hi, because you have extra quotes in your command string, you need to double them up to have them literally appear as part of the command.

In your command, you only to double the quotes around C:\Program Files\EDS\AvLaunch.jar

Regards,

Rob.
	objShell.Run "C:\WINDOWS\system32\java.exe -jar ""C:\Program Files\EDS\AvLaunch.jar"" IMAGEVIEWER.JHMI.COM --type ARS --port 80  --protocol HTTP"

Open in new window

0
 
jhradAuthor Commented:
Thank you.  I had a feeling it was something silly like that.
0
 
RobSampsonCommented:
No problem. Thanks for the grade.

Regards,

Rob.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.