HighTechTalks DotNet Forums  

WScript.Shell Not Working

Dotnet Scripting microsoft.public.dotnet.scripting


Discuss WScript.Shell Not Working in the Dotnet Scripting forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Sterling
 
Posts: n/a

Default WScript.Shell Not Working - 03-24-2005 , 11:35 AM






I am trying to run a command line command from a script with the
WScript.Shell command and the entire script executes fine except this one
part.

It does not error out, and the command executes fine from a command line so
I know I have the syntax correct. What I am thinking (since I inherited the
server it is running on) is that there is some security setting preventing
this command from executing.

Also, the script works correctly, shell command and all, on my personal
workstation.

Does anyone know what security setting (I have combed through local security
policy and searched this site to no avail) might affect this?

Thanks in advance.

Reply With Quote
  #2  
Old   
Michael Harris \(MVP\)
 
Posts: n/a

Default Re: WScript.Shell Not Working - 03-24-2005 , 07:08 PM






Sterling wrote:
Quote:
I am trying to run a command line command from a script with the
WScript.Shell command and the entire script executes fine except this
one part.

It does not error out, and the command executes fine from a command
line so I know I have the syntax correct. What I am thinking (since
I inherited the server it is running on) is that there is some
security setting preventing this command from executing.

Also, the script works correctly, shell command and all, on my
personal workstation.

Does anyone know what security setting (I have combed through local
security policy and searched this site to no avail) might affect this?

Thanks in advance.
You must provide the details of what your script attempts to do via the
WshShell.Run method (there is no WScript.Shell command - that's the progid
used to create an instance of a WshShell object which has a Run method.

The most likely problem is that the command line you build via script is
*not* the same as the command line you type and run via a console window
(cmd.exe instance). For debugging purposes, always build the command line
to execute as the value of a variable the you can display
(msgbox/wscript.echo) for visual inspection for correctness before passing
it to the Run method.

Not that things executed via the Run method won't necessarily throw a script
error. If it executes and returns an error via an exit code, you must use
the bWaitOnReturn True/False argument (3rd) Run method and call it as a
function that returns a value. The value returned will be the exit code of
the process executed. The Run method itself won't throw an error unless is
is unable to run what you ask or you make some syntactic error in the method
call (like wrong number or type of arguments)...



--
Michael Harris
Microsoft MVP Scripting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Please ask follow-up questions via the original newsgroup thread.





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.