Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


A newbie and a question

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> A newbie and a question
  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 >>
 A newbie and a question - 4/30/2008 2:28:13 AM   
  aschwartz

 

Posts: 12
Score: 0
Joined: 4/30/2008
Status: offline
Hi.  I am new to VB scripting, I have been using them for a while, but now my scripting guru who I always bounced ideas off of is no longer available to me, so I need some assistance.

I am running a vbs login script, works great.  I am going to call 2 bat files toward the end to run various subroutines.

Set WSHShell = CreateObject("Wscript.Shell")
WSHShell.Exec ("vpn.bat")

Set WSHShell = CreateObject("Wscript.Shell")
WSHShell.Exec ("wsusreset.bat")


I was using the WSHShell.Run command to run these originally, but the dos box would be displayed.  I changed it (with the help of searching this site) to the WSHShell.Exec command.  And with this the command no longer works, or at least the bat file is not running.  Any thoughts?

Also, do I have to run something after this to clean out the memory, or will this work for what I am using it for?  I have these at the end of the script so I think it will do it.

'Clean Up Memory We Used
Set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
Set WSHPrinters = Nothing


Thanks in advance

< Message edited by aschwartz -- 4/30/2008 2:31:01 AM >
 
 
Post #: 1
 
 RE: A newbie and a question - 4/30/2008 2:31:19 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
As long as the bat files don't leave some processes behind that you care about then this should be fine.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to aschwartz)
 
 
Post #: 2
 
 RE: A newbie and a question - 5/1/2008 1:21:38 AM   
  aschwartz

 

Posts: 12
Score: 0
Joined: 4/30/2008
Status: offline
Thats great to know for the clean up part.

ANy ideas on the actual hiding of a dos box?  I cant get it to work with the exec, and the run doesnt hide it, but it does work.

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: A newbie and a question - 5/1/2008 1:57:34 AM   
  Rischip


Posts: 414
Score: 2
Joined: 3/26/2007
Status: offline
Using the .Run method you can hide the DOS box. http://msdn.microsoft.com/en-us/library/d5fk67ky(VS.85).aspx
Using the .Exec method you cannot. I only use the .Exec method when I need to redirect the Stdin/Stdout back to the script.
That is really it's only true advantage. All other advantages go to .Run.

_____________________________

Rischip
Author of - The Grim Linker

(in reply to aschwartz)
 
 
Post #: 4
 
 RE: A newbie and a question - 5/1/2008 3:05:00 AM   
  aschwartz

 

Posts: 12
Score: 0
Joined: 4/30/2008
Status: offline
Set objShell = WScript.CreateObject("WScript.Shell")
       objShell.Run("%comspec% /C VPN.Bat"), 7, True

I figured it out by using the 7 instead of a 1.  Told you I was a newbie.  lol.
Thanks for the help..

(in reply to Rischip)
 
 
Post #: 5
 
 RE: A newbie and a question - 5/1/2008 3:21:12 AM   
  Rischip


Posts: 414
Score: 2
Joined: 3/26/2007
Status: offline
7 minimizes, 0 hides

_____________________________

Rischip
Author of - The Grim Linker

(in reply to aschwartz)
 
 
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 >> A newbie and a question 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