Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


return value for run method

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> return value for run method
  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 >>
 return value for run method - 8/25/2006 10:03:05 AM   
  buffalokml

 

Posts: 15
Score: 0
Joined: 4/3/2006
Status: offline
Hi all,

does run method has any return value? if not, is there anyway that I could validate to see if my command has been run successful?

If I use

strReturn = objShell.Run(cmd)
WScript.Echo strReturn

It always return 100

If I use

On
Error Resume Next

WScript.Echo Err.Number


It always return 0

Best Regards,

< Message edited by buffalokml -- 8/25/2006 10:42:07 AM >
 
 
Post #: 1
 
 RE: return value for run method - 8/25/2006 1:16:32 PM   
  Cybex


Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
Not sure if this helps because I am not exactly sure what you are trying to do but...

Google says...

WshShell.Run
Run an external Command.
Syntax
    WshShell.Run (strCommand, [intWindowStyle], [bWaitOnReturn])
Parameters
strCommand  :  The Command to be executed
intWindowStyle
(Optional)  :  Int value indicating the appearance of
                the program's window.
                Not all programs make use of this.
bWaitOnReturn : Wait for the command to complete before
                 continuing execution of the wsh script.
If bWaitOnReturn is set to TRUE, the Run method returns any error code returned by the application.
If bWaitOnReturn is not specified or FALSE, this method immediately returns to script execution rather than waiting on the process termination (and returns an error code of 0)
Specifying the bWaitOnReturn parameter allows you to run programs synchronously (one at a time).

< Message edited by Cybex -- 8/25/2006 1:18:50 PM >


_____________________________

Common sense is not so common.

(in reply to buffalokml)
 
 
Post #: 2
 
 RE: return value for run method - 8/25/2006 2:26:20 PM   
  mbouchard


Posts: 1924
Score: 16
Joined: 5/15/2003
From: USA
Status: online
The return value normally comes from the exe and it all depends on what return values the exe has.

Here are a couple examples I tossed together using cmd or ping.  For me the return was either 1 or 0.  Without a return list, I usually check by trial and error what the return should be in certain situations.


      

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to Cybex)
 
 
Post #: 3
 
 RE: return value for run method - 8/28/2006 4:40:08 AM   
  buffalokml

 

Posts: 15
Score: 0
Joined: 4/3/2006
Status: offline
Thanks so much...It works... The code below return me 100 if there is an error and 0 if success.


WScript.Echo
" "

WScript.Echo
"Running command: " & strCommand
strReturn = objShell.Run(
"cmd /c " & strCommand, 0, true)

if
strReturn <> 0 then

WScript.Echo
"Error occured.... "

else

WScript.Echo
"************* Finished *****************"

WScript.Echo
" "

end
if

WScript.Echo strReturn

(in reply to mbouchard)
 
 
Post #: 4
 
 
 
  

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 >> return value for run method 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