# Ruby in windows

**URL:** <https://www.ruby-forum.com/t/ruby-in-windows/130706>\
**Category:** Ruby\
**Created:** [March 2, 2008, 7:25am UTC](https://www.ruby-forum.com/t/ruby-in-windows/130706 "2008-03-02T07:25:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 2, 2008, 7:25am UTC](https://www.ruby-forum.com/t/ruby-in-windows/130706/1 "2008-03-02T07:25:04Z")

</div>

i’m trying to script administrative tasks in windows and i’m really  
not feeling the ruby love, does anyone have some suggestions on a way  
of running commands and catching STDERR in windows?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 2, 2008, 10:55am UTC](https://www.ruby-forum.com/t/ruby-in-windows/130706/2 "2008-03-02T10:55:33Z")

</div>

On Sun, Mar 2, 2008 at 7:24 AM, removed\_email\_address@domain.invalid  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> i’m trying to script administrative tasks in windows and i’m really  
> not feeling the ruby love, does anyone have some suggestions on a way  
> of running commands and catching STDERR in windows?

Try:

1. win32-open3 gem
2. use Kernel#system or `` (backticks) and redirect output to a file  
or pipe. Windows from 2000 up supports stderr  
redirection ( command 2\> err.txt )

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 2, 2008, 7:11pm UTC](https://www.ruby-forum.com/t/ruby-in-windows/130706/3 "2008-03-02T19:11:56Z")

</div>

thanks, thats giving me the io objects back.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 3, 2008, 9:06pm UTC](https://www.ruby-forum.com/t/ruby-in-windows/130706/4 "2008-03-03T21:06:04Z")

</div>

when i run this in production it seems to die while trying to read  
from the Output IO object, if its

io\_in, io\_out, io\_err = Open3.popen(‘some command with parameters’)

out = io\_out.read (hangs here forever if the command should have worked)

On Sun, Mar 2, 2008 at 10:11 AM, removed\_email\_address@domain.invalid
