Wshshell Run Get Return Code
If the Return code is generated "before" the application ends (I don't really know how it could, unless there's some weird recursive application launching going on) then that's all you get. Edited by cjm51213 Tuesday, September 04, 2012 3:42 AM Tuesday, September 04, 2012 3:39 AM Reply | Quote 0 Sign in to vote So you were making up code that we I'm a doctor. The documentation says: "If set to true, script execution halts until the program finishes, and Run returns any error code returned by the program. his comment is here
Not the answer you're looking for? Connect with top rated Experts 10 Experts available now in Live! 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 Results 1 to 2 of 2 Thread: [RESOLVED] Return Code from oshell.run Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to https://social.technet.microsoft.com/Forums/scriptcenter/en-US/4a92021f-0378-46f9-932e-a25f4e18ad55/meaning-of-return-codes-from-wscriptshellrun?forum=ITCG
Vbscript Run Return Code
Doing all of this via API calls just isn't worth it when you've got such a handy object to use.: : : : : : [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]: : : : : : Assuming I am right, and I want to run this script from the Task Scheduler, what am I going to have to do? How was I supposed to know that my mods to your code didnt work. Tuesday, September 04, 2012 10:10 PM Reply | Quote 0 Sign in to vote I ran wbadmin get status in an elevated command window and I get a -2 exit code
Microsoft reserves all rights associated with the materials on this site. The interpretation of that error code depends entirely on that program. Edited by cjm51213 Monday, September 03, 2012 9:55 PM Monday, September 03, 2012 9:55 PM Reply | Quote Answers 0 Sign in to vote I ran wbadmin get status in an Shell.run Error Codes The code I am running is doing the correct thing as evidenced by the lack of a JScript runtime error.
If bWaitOnReturn is set to TRUE, the Run method returns any error code returned by the application. Wshshell Run Vs Exec What is this blue thing in a photograph of a bright light? Not all programs make use of this. http://stackoverflow.com/questions/6060876/vbscript-getting-results-from-shell Question has a verified solution.
iReturn should then be your exit code. Set objShell = CreateObject("WScript.Shell") iReturn=objShell.Run("yourcommmandhere",0,True) wscript.echo iReturn Select all Open in new window 0 LVL 10 Overall: Level 10 VB Script Wscript.shell Exec Stdout p/s: my batch file use to decrypt file with .GPG extension Thanks & Best Regards, Last modified Nov 11, 2009 at4:52AM SvenGroot Dim errorLevel errorLevel = shell.Run("AG_Decrypt_Backup.bat", 1, True) Don't Is it correct name Windows Script Host Object Model or it's listed under some other name?: I have the exact setup as you and found it by that name.It's c:winntsystems32wshocm.ocx 0 Doing all of this via API calls just isn't worth it when you've got such a handy object to use.[size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size] 0 · Share on Facebook infidel Member Posts: 2,900 January 2003
- Nearly every TV website, magazine or online news has one on their site, and even some e-commerce sites have one.
- Bill Marked as answer by IamMredMicrosoft employee, Owner Thursday, September 20, 2012 10:27 PM Tuesday, September 04, 2012 10:16 PM Reply | Quote Moderator All replies 0 Sign in to vote
- Can anyone point me in the right direction, whether it be how to make the "run" method more reliable or modifying the included code to catch the return of the called
- I have had some issue with the Run method of the Wscript object not waiting for the application to finish.
- I am using Win2000, VisualStudio 6.0 Enterprise edition SP 5.
- Without more complete information the question cannot be answered. ¯\_(ツ)_/¯ Tuesday, September 04, 2012 1:21 AM Reply | Quote 0 Sign in to vote It is a Microsoft utilitiy and it
Wshshell Run Vs Exec
Are people of Nordic Nations "happier, healthier" with "a higher standard of living overall than Americans"? https://www.experts-exchange.com/questions/26228291/Call-exe-from-vbscript-wait-for-return-and-catch-return-code.html Bill Tuesday, September 04, 2012 2:26 AM Reply | Quote Moderator 0 Sign in to vote Bill - WBAdmin does not exit with those code. Vbscript Run Return Code undo a gzip recursively Ultimate Australian Canal Movie about a girl who had another different life when she dreamed more hot questions question feed about us tour help blog chat data Vbscript Run Command Get Output The active window remains active. 5 Activate & Restore. 6 Minimize & activate the next top-level window in the Z order. 7 Minimize.
It looks like you're new here. this content Google says... Thanks for the help, Chris. Join the community of 500,000 technology professionals and ask your questions. Wscript.shell Run Return Code 1
Microsoft Customer Support Microsoft Community Forums Script Center Sign in United States (English) Brasil (Português)Česká republika (Čeština)Deutschland (Deutsch)España (Español)France (Français)Indonesia (Bahasa)Italia (Italiano)România (Română)Türkiye (Türkçe)Россия (Русский)ישראל (עברית)المملكة العربية السعودية (العربية)ไทย (ไทย)대한민국 (한국어)中华人民共和国 If I understand your question you want the WScript to return the return value of the command.bat to that end you can do this: var WshShell = WScript.CreateObject("WScript.Shell") var bat_return_value = It is a Microsoftutilitiy and it returns standard Microsoft error codes. -1 and -02 are not MS error codes. weblink Detect MS Windows Why are copper cables round?
Thanks for the help, Chris.
TakadaT, for responding first you get the extra point. 0 Featured Post How to improve team productivity Promoted by Quip, Inc Quip adds documents, spreadsheets, and tasklists to your Slack Your original code had %comspec% /c in Go to Solution 6 4 2 +1 4 Participants TakedaT(6 comments) LVL 10 VB Script9 Scripting Languages3 cusas76(4 comments) CitizenRon(2 comments) LVL 7 VB asked 5 years ago viewed 30104 times active 3 years ago Linked 2 JScript: how to run external command and get output? 1 VBScript - Capturing output from stdout 0 VBA Wscript.shell Methods Try this one: Const WshFinished = 1 Const WshFailed = 2 strCommand = "ping.exe 127.0.0.1" Set WshShell = CreateObject("WScript.Shell") Set WshShellExec = WshShell.Exec(strCommand) Select Case WshShellExec.Status Case WshFinished strOutput = WshShellExec.StdOut.ReadAll
In any case this is not a scripting question. The first step is always read the docs and when they are silent, the second step is to ask your friends. How do I go about resolving these mysteries? check over here I've originally tried the code you suggested even before I entered this forum.
Bill Proposed as answer by Bill_StewartModerator Tuesday, September 04, 2012 11:33 PM Tuesday, September 04, 2012 12:55 AM Reply | Quote Moderator 0 Sign in to vote Bill - WBadmin is You can use various API calls to find stuff out about processes, but it's a lot more hassle than it should be. Written and compiled by Réal Gagnon ©1998-2016 [ home ]