Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Run a bat file or vbs file from a checked box

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,60026
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Run a bat file or vbs file from a checked box
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Run a bat file or vbs file from a checked box - 5/9/2008 1:52:15 AM   
  Dicko1976

 

Posts: 22
Score: 0
Joined: 3/5/2008
Status: online
Hi all

I have created a hta file that asks the IT engineer to select the software that they would like to install on to the PC. I get the check box system to work with a msgbox reply.

eg if I tick Office 2000 and Winzip then it come back with a msg that its installing.

I now need to replace the msg box with the actual vbs or bat file to install the software

How would I do this ?? I tried with objShell.Run("C:\Program Files\Windows NT\CF18-19Menu.vbs")  but that just comes up with an error

Below is part of my script that the if statement works with the check boxes

If Winzip.Checked Then
MsgBox "Winzip is been Installed"
'objShell.Run("C:\Program Files\Windows NT\CF18-19Menu.vbs") This is disabled at the moment as it didnt work

End If
If MSOffice2000Std.Checked Then
MsgBox "Office 2000 Std is been Installed"
End If
If LotusNotes.Checked Then
MsgBox "Lotus Notes is been Installed"
End If
If AcrobatReader.Checked Then
MsgBox "Acrobat Reader is been Installed"
End If
End Sub

Any help woul be gratefully received
 
 
Post #: 1
 
 RE: Run a bat file or vbs file from a checked box - 5/9/2008 5:13:02 AM   
  chiltz

 

Posts: 52
Score: 0
Joined: 6/13/2007
Status: offline
what is the error you get.  Also you do have "Set objShell = CreateObject("WScript.Shell")" in your script just before the code you posted right.

(in reply to Dicko1976)
 
 
Post #: 2
 
 RE: Run a bat file or vbs file from a checked box - 5/9/2008 7:31:28 AM   
  Fredledingue


Posts: 297
Score: 0
Joined: 5/9/2005
From:
Status: offline
The error can also be because there is a white space in the command line. objShel.run doesn't support white spaces because white spaces are read as variable separators.
Use the shortpath instead to avoid this error.

HTH

_____________________________

Fred

(in reply to chiltz)
 
 
Post #: 3
 
 RE: Run a bat file or vbs file from a checked box - 5/11/2008 7:43:58 PM   
  Dicko1976

 

Posts: 22
Score: 0
Joined: 3/5/2008
Status: online
All

Thanks for your advice but I think Ive solved it but I did have the "Set objShell = CreateObject("WScript.Shell")" just before the code I pasted on friday.

I set the link as "objshell.Run(file:///C:/Program%20Files/Windows%20NT/CF18-19Menu.vbs)"  and it worked. Not sure if this is correct but its working or only because its in a HTA file.

Thanks again

Martyn

(in reply to Fredledingue)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Run a bat file or vbs file from a checked box Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts