Invoking a batch file with Ruby on Windows

B

brian.kejser

Hi

Does anyone know how I could invoke a Windows batch file (e.g.
MyBatchFile.bat) and check the ERRORLEVEL environment variable after the
batch file completes execution.

Thanks
 
J

Jan Svitok

Hi

Does anyone know how I could invoke a Windows batch file (e.g.
MyBatchFile.bat) and check the ERRORLEVEL environment variable after the
batch file completes execution.

Thanks

1. Try:
- `MyBatchFile.bat`
- system "MyBatchFile.bat"
- the same but with "cmd /c MyBatchFile.bat" (or /k , I don't remember exactly)

$? should contain the errorlevel (exit status)

I'm writing out of my head, if that won't help, just ask again,
tomorrow (i.e. in 10 hours) I can provide the right solution from my
code.

J.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,840
Latest member
BrendanG78

Latest Threads

Top