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") The code below return me 100if there is an error and 0 if success. How can I easily double any size number in my head? Assuming I am right, and I want to run this script from the Task Scheduler, what am I going to have to do?
If a file type has been properly registered to a particular program, calling run on a file of that type executes the program. Help with a prime number spiral which turns 90 degrees at each prime Lithium Battery Protection Circuit - Why are there two MOSFETs in series, reversed? So to stop this nonsense, this is what I am really doing: cmd = new ActiveXObject("Wscript.Shell"); r = cmd.Run("WBAdmin ...", 0, true); O.K., now, do you have any insight into the Cheers,Dave"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software."<-- MeFor all your testing needs: forum1393: Systems & Software Testing RE: WshShell.Run
The first thing I would find out is if these exit codes are documented somewhere. How do I go about resolving these mysteries? However, if you launch a windowed application such as calc.exe, you would need a loop since the command line would return before the program execution ended.
I have a hunch not. more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed If the oShell.run actually waits, then I don't need to do the objWMIService.Execquery. Wscript.shell Exec Stdout I eventually found how to make my script work outside of this forum.
The entire script segment that you posted can come down to the following lines: '----------------------------------------------------------------- strCommandLine = "C:\someapp.exe" Set wshShell = CreateObject("WScript.Shell") iReturn = wshShell.Run(strCommandLine, 1, True) '----------------------------------------------------------------- The line above Vbscript Run Command Get Output It is a Microsoftutilitiy and it returns standard Microsoft error codes. -1 and -02 are not MS error codes. We cannot tell what is happening without seeing the rest of the script. DPlank (IS/IT--Management) (OP) 2 May 08 09:24 Hi, thanks for the suggestion!Unfortunately in the evaluation of the rc (the actual run command) the runtime exception occurs and the function halts, which
In Win32, an exit code is a 32-bit unsigned integer (DWORD). Vbscript Return Code It returns 0 (meaning Running) Fixed at stackoverflow.com/questions/32920690/… –ChrisJJ Oct 19 at 22:23 | show 1 more comment Your Answer draft saved draft discarded Sign up or log in Sign All times are GMT -5. If you insist on a custom wrapper then perhaps you can post the actual code that is being used.
This is easy to test, and I will test this first thing tomorrow and tell you want I learn. DPlank (IS/IT--Management) (OP) 2 May 08 10:34 I've taken the easy way out - easy being the one you think of ages after posing the question...I wrapped the Run command in Wshshell Run Vs Exec You can then test it using lines like: If iReturn <>0 Then MsgBox "Error: "& iReturn &" returned from "& strCommandLine Else MsgBox "Success - Return: 0 Wscript.shell Run Return Code 1 http://msdn.microsoft.com/en-us/library/d5fk67ky.aspx 0 Message Author Comment by:cusas76 ID: 328933512010-06-01 Sorry, I thought I had attached it.
That line of code cannot execute a run command. Great for personal to-do lists, project milestones, team priorities and launch plans. - Combine task lists, docs, spreadsheets, and chat in one - View and edit from mobile/offline - Cut down I do have another problem, and I'll start another thread for that. Resources Join | Advertise Copyright © 1998-2016 ENGINEERING.com, Inc.
Problem solved. Wscript.shell Methods See the Microsft documetation on system and application error generation in the SDK. -1 and -2 are not Windows system error codes ever. ¯\_(ツ)_/¯ Edited by jrv Tuesday, September 04, 2012 Could it be related to Windows XP vs Windows 7 or the script host you are using?Thank you,Kevin Sign In·ViewThread·Permalink Re: Thank you Eduardo Mozart de Oliveira27-Jan-14 10:57 Eduardo Mozart
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 Am I paranoid, or are corporate firewalls censoring entire countries? Thanks for the help, Chris. Vbscript Return Value Is it a WSF file?
Sign In·ViewThread·Permalink Need assistance Member 110557503-Sep-14 2:52 Member 110557503-Sep-14 2:52 Hi Oliveira, I want to run a command in command prompt of Windows client server, will this work for me It will call the correct version of CMD.exe depending on the ARCH of your OS. Thanks, Scott 0 Comment Question by:cusas76 Facebook Twitter LinkedIn https://www.experts-exchange.com/questions/26228291/Call-exe-from-vbscript-wait-for-return-and-catch-return-code.htmlcopy LVL 10 Best Solution byTakedaT I was not giving an attitude, I was just stating that you had not responded to For example, if Word is installed on your computer system, calling Run on a *.doc file starts Word, and loads the document.
After some more consideration, I am willing to bet I have a permission problem and that is what -2 means. Can you offer any insight to the stated question? Second rate people hire third rate people. Join Us! *Tek-Tips's functionality depends on members receiving e-mail.
Join Now For immediate help use Live now! All rights reserved. note - this type of process kill does not clean up properly and may cause memory leaks - use only as a last resort! “First rate people hire other first rate