Jump to content

Shellexecute and exitcode question


Recommended Posts

Guys

I am trying to use the ShellExecuteWait function, and the example from the helpfile shown below works well and returns a meesage box stating the exit code of zero

$val = ShellExecuteWait("Notepad.exe")

; script waits until Notepad closes
MsgBox(0, "Program returned with exit code:", $val)oÝ÷ Øz0z÷«-ëwöƲ¶­¶W°jÉèµú.Ö¬²0·¥£®¶­sbb33c·fÂÒ6VÆÄWV7WFUvBgV÷C´æ÷FWBæVRgV÷C² £²67&BvG2VçFÂæ÷FWB6Æ÷6W0¤×6t&÷ÂgV÷Cµ&öw&Ò&WGW&æVBvFWB6öFS¢gV÷C²Âb33c·fÂ

All I get is a normal windows error, but no exit code. (See attached pic)

The reason I need this exit code for no file found is that with the current app I am writing, I need to write meaningful messages to the event viewer...so in this case a "file not found" won't give me a exit code, but only a gui message

How could I rectify this?

Cheers

post-2827-1201834805_thumb.jpg

Link to post
Share on other sites

All I get is a normal windows error, but no exit code.

You need a file to run to get an exitcode from it. As weaponx shows, @error can silently pick up the error instead of the msgbox if RunErrorsFatal Opt is set off (apparently latest beta has it off as default).
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...