Invoking a batch file with Ruby on Windows

Discussion in 'Ruby' started by brian.kejser@protexis.com, Aug 21, 2006.

  1. Guest

    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
     
    , Aug 21, 2006
    #1
    1. Advertising

  2. Jan Svitok Guest

    On 8/21/06, <> 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.
     
    Jan Svitok, Aug 21, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ike
    Replies:
    1
    Views:
    324
    Sandip Chitale
    Aug 14, 2003
  2. Replies:
    7
    Views:
    5,761
    Steve W. Jackson
    Apr 12, 2005
  3. Replies:
    1
    Views:
    493
    Andrew Thompson
    Jul 18, 2005
  4. NetKev
    Replies:
    0
    Views:
    1,955
    NetKev
    May 26, 2006
  5. Anukul Singhal
    Replies:
    4
    Views:
    247
    Anukul Singhal
    Mar 20, 2008
Loading...

Share This Page