Wshshell Run Vs Exec
You have to "hook" the return code ("iReturn=oShell.run(shellCommand,1,True)") at the moment you launch it, you can't grab it after the fact. The first thing I would find out is if these exit codes are documented somewhere. I don't think this is a problem with the vbs file permissions or the permissions on cscript.exe, both of which I have granted full control to for i_usr and i_wam whilst Related 0Retrieving DLL Metadata from VBScript?0Quotes in vbscript string causes wsh invalid url error0get result from a vbscript in c#1I am unable to delete a file on the Desktop (All Users) navigate here
I suggest finding a more appropriate forum for asking about wbadmin.exe and/or looking up the documentation for that program. Hi, I don't use that utility, but there's not a rule that all command-line programs must exit with a valid Win32 error code value; it's merely a very widely followed convention. The line r = Wscript.Shell.Run("WBAdmin ...", 0, true); is nota legitimate jscript line of code. I am having a lot of problems with the obj.run functions returning a value after executing. http://stackoverflow.com/questions/19046629/wshshell-run-always-returns-exit-code-0
Wshshell Run Vs Exec
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. Funny 1 Funny 2 Funny 3 Funny 4 One line Deep Thoughts Ascii Art Deprecated (old stuff) Java Language String and Number AWT Swing Environment IO JS interaction JDBC Thread Are the guns on a fighter jet fixed or can they be aimed? I am now curious if using the code I originally posted if I can get the return code from the oShell.run after the loop.
If you use the correct or at least usab;e ActiveX activation then teh returncode would be meaningful. The WScript file contains one line, WScript.Quit. It is a Microsoftutilitiy and it returns standard Microsoft error codes. -1 and -02 are not MS error codes. Wscript.shell Exec Stdout Yes.
I had moved cscript as part of IIS lockdown. Wscript.shell Run Return Code 1 The fact that these are not Win32 error codes doesn't mean a program can't use them as exit codes. Can this number be written in (3^x) - 1 format? http://www.visualbasicscript.com/return-value-for-run-method-m37325.aspx So you must check the highest possible value first. [somescript.vbs] ' even with a return code of 2, the DOS IF ERRORLEVEL 1 will catch it wscript.Quit(2) @echo off wscript somescript.vbs
Uncomment if script does not run correctly.'WScript.Echo Laptop'exitcode echo to ensure variable was correctly set and passed out of "for" loop. Vbscript Return Code Hope this helps, Daz. 0 How your wiki can always stay up-to-date Promoted by Quip, Inc Quip doubles as a “living” wiki and a project management tool that evolves with your current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. What is the meaning of the return codes -1 and -2?
Wscript.shell Run Return Code 1
All times are GMT -5. http://stackoverflow.com/questions/6060876/vbscript-getting-results-from-shell That said, if the code below doesnt return the proper value you are expecting, then as CitizenRon states above, it just really isnt possible from my experience. shellCommand=chr(34)&"C:\someapp.exe"&chr(34) Set oShell=CreateObject("Wscript.Shell") Wshshell Run Vs Exec I have concluded that -1 means something issyntacticallywrong with the command, so I have to assume that WBAdmin is returning these values and this is probably not really a scripting question Shell.run Error Codes Join them; it only takes a minute: Sign up VBScript getting results from Shell up vote 0 down vote favorite 2 Set wshShell = WScript.CreateObject ("WSCript.shell") wshshell.run "runas ..." How do
Script returning an exit code [script.vbs] exitCode = InputBox ( "Enter Exit Code (0 - 255)", "Script", "0") If Not IsNumeric(exitCode) Then exitCode = 0 wscript.Quit(exitCode Mod 255) Script to handle Something wlse in your code is a probelm and it is not possible to knwo what that is because you will not post the eal code. From zero to parabola in 2 symbols Encryption - How to claim authorship anonymously? Remember that we cannot see your screen. Vbscript Run Command Get Output
First I wanted to factor out scripting and find out what the error codes actually mean. Wscript.shell Methods You'll find this interesting. That is the real question here.
Why do shampoo ingredient labels feature the the term "Aqua"?
Did Jack die at the end from a shotgun wound? Advanced Search VBForums Visual Basic ASP, VB Script [RESOLVED] Return Code from oshell.run If this is your first visit, be sure to check out the FAQ by clicking the link above. still doesn't work. Vbscript Return Value In that case teh return code may not be what you expect.
All rights reserved. Run does not provide access to standard streams. –Nilpo Jan 5 '16 at 22:25 Note: This is asynchronous so you will likely see an incorrect WshShellExec.Status at Select Case Why are copper cables round? The DOS IF ERRORLEVEL construction has one strange feature, it returns TRUE if the return code is equal to or higher than the specified errorlevel.
Running from the command prompt, I am told I must be running withadministrativepermissions, so I am, but I suspect that I am not running my JScript as Administrator. The interpretation of that error code depends entirely on that program. If you haev an access error it will likely be a return of 5. Or you could even cut the suspense and tell me what -1 and -2 mean?
How was I supposed to know that my mods to your code didnt work. Exit code of the application run via runas? Thanks for the help, Chris. 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
Is the binomial theorem actually more efficient than just distributing Why does the `reset` command include a delay? Should we kill the features that users are not using frequently, to improve performance?