Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


WshShell.Run problems

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1574
 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 problems
  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 problems - 11/4/2004 3:29:01 AM   
  hbomb

 

Posts: 14
Score: 0
Joined: 10/20/2004
From: USA
Status: offline
I am having problems with my master VBscript opening another script. I am using this as my statement:

objShell.Run "%LOGONSERVER%\netlogon\SR\VBS\printer.vbs,0,True"

Can anyone please tell me why this doesn't work?
 
 
Post #: 1
 
 Re: WshShell.Run problems - 11/4/2004 6:06:59 AM   
  hbomb

 

Posts: 14
Score: 0
Joined: 10/20/2004
From: USA
Status: offline
Come on people, I thought this would be simple to experienced VBS programmers. CAN SOMEONE PLEASE HELP ME! I really need this to work.

(in reply to hbomb)
 
 
Post #: 2
 
 Re: WshShell.Run problems - 11/4/2004 7:01:27 AM   
  mbouchard


Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
First off, patience, most of the people who post here are at work and can only check sproadically throughout the day.
Try this.

Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
msgbox WshShell.ExpandEnvironmentStrings("%LOGONSERVER%")

(in reply to hbomb)
 
 
Post #: 3
 
 Re: WshShell.Run problems - 11/4/2004 12:08:43 PM   
  hbomb

 

Posts: 14
Score: 0
Joined: 10/20/2004
From: USA
Status: offline
I need for my master script to execute then open that printer.vbs script. I don't need to know what logonserver I am logging in.

(in reply to hbomb)
 
 
Post #: 4
 
 Re: WshShell.Run problems - 11/5/2004 12:30:08 AM   
  mbouchard


Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
Then edit the code that I posted to work for you. I was just using a msgbox to display the results.

(in reply to hbomb)
 
 
Post #: 5
 
 Re: WshShell.Run problems - 11/9/2004 5:23:38 AM   
  hbomb

 

Posts: 14
Score: 0
Joined: 10/20/2004
From: USA
Status: offline
I'm not trying to be sarcastic, but my original post contained:

objShell.Run "%LOGONSERVER%\netlogon\SR\VBS\printer.vbs,0,True"

it is safe to assume that I have Dim objShell and Set objShell = CreateObject("WScript.Shell")

my problem is for some reason objShell.Run always tells me that that file can't be found and it is there.Because I can take that same path and place it on the command line and it is executed.

(in reply to hbomb)
 
 
Post #: 6
 
 Re: WshShell.Run problems - 11/9/2004 6:58:14 AM   
  mbouchard


Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
I know what you posted and so I posted the info that could help if you tried it. Unless you use a cmd window (would need to test this to be positive), %whatever% will not work. That is a system variable and needs to be expanded.

'set a variable
TheVariable = WshShell.ExpandEnvironmentStrings("%LOGONSERVER%")
'Then use this variable in your run line.
objShell.Run TheVariable & "\netlogon\SR\VBS\printer.vbs,0,True"
That should do it.

(in reply to hbomb)
 
 
Post #: 7
 
 Re: WshShell.Run problems - 11/10/2004 4:02:45 AM   
  hbomb

 

Posts: 14
Score: 0
Joined: 10/20/2004
From: USA
Status: offline
Thanks for the help. It seems that VBscript didn't like the ,0,True portion of my original line. So I used this line below and it worked fine. Again, thanks for the help.

objShell.Run TheVariable & "\netlogon\SR\VBS\printer.vbs"

(in reply to hbomb)
 
 
Post #: 8
 
 Re: WshShell.Run problems - 11/10/2004 5:51:06 AM   
  mbouchard


Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
put the ,0,TRUE outside the quotes

(in reply to hbomb)
 
 
Post #: 9
 
 
 
  

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 problems 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