|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
||||
|
||||
|
__________________
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! |
|
#4
|
||||
|
||||
|
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. |
|
#5
|
||||
|
||||
|
Quote:
I didn't know it was the same guy, ... Irony it is. Quote:
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. |
|
#6
|
||||
|
||||
|
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 |
|
#7
|
||||
|
||||
|
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.
|
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > WSH - WshShell.Run command question(s) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|