Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 1st, 2008, 04:31 PM
Hangman Hangman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 30 Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 7 h 12 m 30 sec
Reputation Power: 19
WSH - WshShell.Run command question(s)

Alright, I have more questions for you all.
I'll bet your getting tired of me already.

So, I can make the programs work as shown below:
Code:
objWshShell.Run "C:\WINDOWS\SYSTEM32\cleanmgr /sagerun:64"
   and
objWshShell.Run "C:\Windows\System32\defrag C: -a"
   and
objWshShell.Run "C:\Windows\explorer"

But I can't get it to run with these commands:
Code:
objWshShell.Run "c:\Program Files\Internet Explorer\iexplore"
   or
objWshShell.Run "C:\Program Files\Microsoft Office\Office10\OUTLOOK"

One of many thoughts is that the 'Program Files\Internet Explorer\... ' and the 'Program Files\Microsoft Office\... ' are not in a search path. But it doesn't make a lot of sense to me as to why they even should be in a search path. Unless XP pro is still only a shell and we are still truly running off of DOS.
Now, according to the MSDN library , they should run as posted in the code above. However, if these are actually DOS commands, then the MSDN library here tells me I should be using the WshShell.'exec' command.

Can someone enlighten me as to why only certain commands can be run using the 'WshShell.Run' command and others can't ??

On a side note, I have the O'Reilly VBScript Pocket Reference that I'm wearing out, and it doesn't even have the 'WshShell.Run' command listed. Can someone suggest a good pocket reference manual I can purchase that would have these (appearently obscure) commands in them ??

Thank you all for putting up with me and for your precious suggestions and input.

Reply With Quote
  #2  
Old August 1st, 2008, 06:06 PM
Hangman Hangman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 30 Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 7 h 12 m 30 sec
Reputation Power: 19
WshShell.Run - obscure fix - ...

Ha Ha !!! I think I found it. Answered my own question.
Check this out:
Executing an EXE inside a VBScript file

Who'd a thunk it was a long path name with spaces in it.
but it makes sense.

Hey, thanks guys, you did it again.
Seriously though, if Nilpo hadn't of pointed me to the MSDN library in one of my earlier posts, I don't believe I would have found this link. So, Thank you.

Reply With Quote
  #3  
Old August 2nd, 2008, 01:06 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,668 Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 1 Day 8 h 25 m 52 sec
Reputation Power: 867
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
You got it, bud. Watch those quotes. It's also a good idea to keep the file extensions.
vb Code:
Original - vb Code
  1. Set WshShell = CreatObject("WScript.Shell")
  2. WshShell.Run Chr(34) & "C:\Program Files\Internet Explorer\iexplore.exe" & Chr(34)
__________________
Don't like me? Click it.

Scripting problems? Windows questions? Ask the Windows Guru!

Stay up to date with all of my latest content. Follow me on Twitter!

Help us help you! Post your exact error message with these easy tips!

Reply With Quote
  #4  
Old August 2nd, 2008, 03:29 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,668 Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 1 Day 8 h 25 m 52 sec
Reputation Power: 867
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
How about a bit of irony? I just took a look at your link and noticed it was Steve Schofield's Weblog. That's the same Steve Schofield that started ASP Free.

Last edited by Nilpo : August 2nd, 2008 at 03:35 PM.

Reply With Quote
  #5  
Old August 4th, 2008, 11:08 AM
Hangman Hangman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 30 Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 7 h 12 m 30 sec
Reputation Power: 19
Quote:
Originally Posted by Nilpo
How about a bit of irony? I just took a look at your link and noticed it was Steve Schofield's Weblog. That's the same Steve Schofield that started ASP Free.

I didn't know it was the same guy, ... Irony it is.
Quote:
Originally Posted by Nilpo
You got it, bud. Watch those quotes. It's also a good idea to keep the file extensions.
vb Code:
Original - vb Code
  1. Set WshShell = CreatObject("WScript.Shell")
  2. WshShell.Run Chr(34) & "C:\Program Files\Internet Explorer\iexplore.exe" & Chr(34)


I also found in the comments below the following for using switches. There are two ways of adding switches to the exe's.
Code:
objWshShell.Run """C:\Program Files\Microsoft Office\Office10\OUTLOOK.exe"" /recycle"
or 
objWshShell.Run """C:\Program Files\Microsoft Office\Office10\OUTLOOK.exe""" & "/recycle"

I prefer the first, but both work.

A question regarding Nilpo's post though, what is the 'Chr(34)' you have in your code ?? I saw it in one of the comments on that link, but I haven't been able to find an explanation of it yet.

Thanks.
edited: missed a piece of code.

Reply With Quote
  #6  
Old August 4th, 2008, 11:43 AM
mehere's Avatar
mehere mehere is offline
Senior Sarcasm Wizardess
Click here for more information.
 
Join Date: Feb 2005
Location: Dreamland
Posts: 13,043 mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)mehere User rank is General 13rd Grade (Above 100000 Reputation Level)  Folding Points: 10976 Folding Title: Novice Folder
Time spent in forums: 5 Months 11 h 15 m 13 sec
Reputation Power: 1873
chr(34) is the ascii form of double quotes (")
__________________
Come JOIN the party!!!

Quote of the Month:
Pretension: The downside of being better than everyone else is that people tend to assume you're pretentious.

Questions to Ponder:
You can be overwhelmed and underwhelmed, but why can't you be simply whelmed?

iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
copyright© 2008 sbenj69

Reply With Quote
  #7  
Old August 4th, 2008, 02:03 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,668 Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)Nilpo User rank is Lieutenant General (80000 - 90000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 1 Day 8 h 25 m 52 sec
Reputation Power: 867
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Mehere is right, Chr(34) returns a text character for ASCII Character 34 which is a double quote. Using Chr(34) is often less confusing than doubling up on quotation marks.

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > WSH - WshShell.Run command question(s)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT