Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


RE: Newbie Question - Quotes within a objShell.exec

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RE: Newbie Question - Quotes within a objShell.exec
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
 RE: Newbie Question - Quotes within a objShell.exec - 3/11/2008 5:04:53 AM   
  GreatBarrier86

 

Posts: 71
Score: 0
Joined: 3/10/2008
Status: offline
I'm with you on that. Although for right now, since most of my office's computers don't have PoSh on them, i'll stick with vbscript. However, when the opportunity arises to use powershell, i am all over it. It seems to me, if i am correct that you can invoke Wshell just as easily in powershell as you can in VBScript.

One last thing, if you don't mind. How do you handle the use of environmental variables in VBScript.

For instance, objShell.Run "cmd /c del C:\Users\Public\Desktop\Sysprep.vbs"

Obviously, C:\Users\Public can be condensed down into an envirnomental variable. I just don't know how to invoke it in VB.

(in reply to ebgreen)
 
 
Post #: 21
 
 RE: Newbie Question - Quotes within a objShell.exec - 3/11/2008 5:10:07 AM   
  ebgreen


Posts: 4972
Score: 31
Joined: 7/12/2005
Status: offline
Well there is the VBS way and then there is the cmd way. When you execute that command you are actually creating a command prompt, so the command behaves just like it would at a command prompt:

objShell.Run "cmd /c del %DESKTOP%\Sysprep.vbs"

Assuming that you have an environment variable DESKTOP that points to that path. For the VBS way, look at the documentation for ExpandEnvironmentStrings and/or SpecialFolders.

_____________________________

"... 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 GreatBarrier86)
 
 
Post #: 22
 
 RE: Newbie Question - Quotes within a objShell.exec - 3/11/2008 5:23:16 AM   
  GreatBarrier86

 

Posts: 71
Score: 0
Joined: 3/10/2008
Status: offline
Thanks. I'll look into that. I'd only use the %% stuff if i am working directory with cmd /c.

(in reply to ebgreen)
 
 
Post #: 23
 
 RE: Newbie Question - Quotes within a objShell.exec - 3/14/2008 2:28:51 PM   
  GreatBarrier86

 

Posts: 71
Score: 0
Joined: 3/10/2008
Status: offline
Oh btw, when dealing with Env variables, do you recommend the use of Special Folders or ExpandEnvironmentStrings?

(in reply to GreatBarrier86)
 
 
Post #: 24
 
 RE: Newbie Question - Quotes within a objShell.exec - 3/15/2008 5:38:49 AM   
  dm_4ever


Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
I would say whichever provides you what you need....
Special Folders only provides Temp, Windows, System32 paths
Expand Environment Strings will provide those evnvironmental variables available
Shell.Application provides even more "special" folders...but you should work and understand the information you've been provided so far.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to GreatBarrier86)
 
 
Post #: 25
 
 RE: Newbie Question - Quotes within a objShell.exec - 3/15/2008 12:47:12 PM   
  GreatBarrier86

 

Posts: 71
Score: 0
Joined: 3/10/2008
Status: offline
Heh...thanks DM..

I likethe idea of EES because it provides Spec.Folders plus everything else.

As for concentrating on what i already know, i've pretty much absorbed eveything. Makes a lot of sense to me.

(in reply to dm_4ever)
 
 
Post #: 26
 
 
Page:  <<   < prev  1 [2]
 
  

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 >> RE: Newbie Question - Quotes within a objShell.exec Page: <<   < prev  1 [2]
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