Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


WshShell.Run

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WshShell.Run
  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 >>
 WshShell.Run - 7/21/2004 7:52:48 PM   
  ajhw2

 

Posts: 3
Score: 0
Joined: 7/21/2004
From:
Status: offline
Hello,
I am trying to run the simple script below to start a couple of applications. It works OK with some but not with others, with an error of not being able to find the file. The only apparent difference in the files that won't work is that when viewed in Win explorer they appear to have one or two spaces at the end of the filename which can't be deleted.

Set WshShell = WScript.CreateObject ("WScript.Shell")
WshShell.Run "Netscp", 1,False
Set WshShell2 = WScript.CreateObject ("WScript.Shell")
WshShell2.Run "EXCEL", 1,False

Thanks in anticipation
 
 
Post #: 1
 
 Re: WshShell.Run - 7/21/2004 11:13:15 PM   
  mbouchard


Posts: 1861
Score: 14
Joined: 5/15/2003
From: USA
Status: offline
I am not sure that I am following you. Are you saying that the file name has several spaces at the end of the name when you highlight it and start to rename it? What error are you getting when attempting to run the apps?

Also, there is no need to do this

Set WshShell = WScript.CreateObject ("WScript.Shell")
Set WshShell2 = WScript.CreateObject ("WScript.Shell")

As WshShell.Run can be used as many times as needed in the script.

(in reply to ajhw2)
 
 
Post #: 2
 
 Re: WshShell.Run - 7/22/2004 12:55:59 AM   
  ajhw2

 

Posts: 3
Score: 0
Joined: 7/21/2004
From:
Status: offline
When the file name is highlighted for renaming, the name is highlighted in blue but the box surrounding it is longer than the name. I think that this may be irrelevant, as I have checked more instances and some of the ones that work appear like this as well.

The fault generated is as follows:
"The system cannot find the file specified
Code: 80070002
Source: (null)

I have tried using the full file path, with and without the file extension and that doesn't help either.


Thanks

Al

(in reply to ajhw2)
 
 
Post #: 3
 
 Re: WshShell.Run - 7/22/2004 1:42:21 AM   
  mbouchard


Posts: 1861
Score: 14
Joined: 5/15/2003
From: USA
Status: offline
Does your path have spaces in it? If so you will need to add some quotes around the path. for instance
While this will give you an error
wshShell.Run "C:\Program Files\Internet Explorer\iEXPLORE.EXE",1,true
This one will work
wshShell.Run """C:\Program Files\Internet Explorer\iEXPLORE.EXE""",1,true

Mike

(in reply to ajhw2)
 
 
Post #: 4
 
 Re: WshShell.Run - 7/22/2004 2:36:43 AM   
  ajhw2

 

Posts: 3
Score: 0
Joined: 7/21/2004
From:
Status: offline
Mike,

That has done the trick

Many thanks

Al

(in reply to ajhw2)
 
 
Post #: 5
 
 Re: WshShell.Run - 7/22/2004 3:25:15 AM   
  mbouchard


Posts: 1861
Score: 14
Joined: 5/15/2003
From: USA
Status: offline
Welcome

(in reply to ajhw2)
 
 
Post #: 6
 
 
 
  

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 >> WshShell.Run 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