Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Invoking a batch file with Ruby on Windows

Reply
Thread Tools

Invoking a batch file with Ruby on Windows

 
 
brian.kejser@protexis.com
Guest
Posts: n/a
 
      08-20-2006
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


 
Reply With Quote
 
 
 
 
Jan Svitok
Guest
Posts: n/a
 
      08-21-2006
On 8/21/06, http://www.velocityreviews.com/forums/(E-Mail Removed) <(E-Mail Removed)> wrote:
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invoking Ruby code from a low-level language? Alex Fulton Ruby 10 12-16-2008 11:54 PM
Invoking a windows application (e.g notepad) from ruby Anukul Singhal Ruby 4 03-20-2008 07:02 AM
Ruby Gem Creates Broken Batch File for Rake Bret Pettichord Ruby 2 04-10-2007 07:41 PM
Question: Invoking custom file type (file associated with custom app) VB Programmer ASP .Net 1 11-03-2003 11:49 PM
Invoking Windows apps from file type Ike Java 1 08-14-2003 10:09 PM



Advertisments