Code 33 using WinExec

 

Hi. I'm trying to call a ruby script using WinExec external function. I set all parameters that allows it to use external parameters. I'm getting the error 33. I can't find a useful answer about this question.

My code:

Comment("Resulting: ", WinExec("c:\ruby192\bin\ruby.exe c:\myfile.rb"));

And it's returning 33. Anybody knows about this code? how can I do that?

 
jonatas:

Hi. I'm trying to call a ruby script using WinExec external function. I set all parameters that allows it to use external parameters. I'm getting the error 33. I can't find a useful answer about this question.

My code:

Comment("Resulting: ", WinExec("c:\ruby192\bin\ruby.exe c:\myfile.rb"));

And it's returning 33. Anybody knows about this code? how can I do that?

You can try it with ShellExecuteA()...
 

Error 33: it's impossible to access the file. Have you tried this:

Comment("Resulting: ", WinExec("c:\\ruby192\\bin\\ruby.exe c:\\myfile.rb"));  

 ?

 
jonatas:

And it's returning 33. Anybody knows about this code? how can I do that?

33 is meant to indicate success. See http://msdn.microsoft.com/en-us/library/ms687393(VS.85).aspx: "If the function succeeds, the return value is greater than 31." If WinExec() returns 33 then the file should have been run successfully.
 
Thank you very much everybody! I fix the errors in both cases.
Reason: