# Run the program and return immediately

**URL:** <https://www.ruby-forum.com/t/run-the-program-and-return-immediately/129918>\
**Category:** Ruby\
**Created:** [February 22, 2008, 5:59pm UTC](https://www.ruby-forum.com/t/run-the-program-and-return-immediately/129918 "2008-02-22T17:59:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Victor\_SZverokS\_She](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/46a35a/32.png) [@Victor\_SZverokS\_She](https://www.ruby-forum.com/u/Victor_SZverokS_She)\
**Post date:** [February 22, 2008, 5:59pm UTC](https://www.ruby-forum.com/t/run-the-program-and-return-immediately/129918/1 "2008-02-22T17:59:48Z")

</div>

Hi all.

The question first seemed simple for me, but after hour of  
manual-reading  
and googling I still have no answer.

The question: on Windows, how do I run some program and return  
immediately?  
I mean, something like

system(‘blah.exe’) #blah is long packet program, I want system to return  
immediately after blah.exe loaded, not after it was ended.

Thanks.

Zve

---

<div class="post-metadata">

**Author:** ![Victor\_SZverokS\_She](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/46a35a/32.png) [@Victor\_SZverokS\_She](https://www.ruby-forum.com/u/Victor_SZverokS_She)\
**Post date:** [February 22, 2008, 6:20pm UTC](https://www.ruby-forum.com/t/run-the-program-and-return-immediately/129918/2 "2008-02-22T18:20:39Z")

</div>

Victor ‘Zverok’ Shepelev wrote:

> Hi all.
> 
> The question first seemed simple for me, but after hour of  
> manual-reading  
> and googling I still have no answer.
> 
> The question: on Windows, how do I run some program and return  
> immediately?  
> I mean, something like
> 
> system(‘blah.exe’) #blah is long packet program, I want system to return  
> immediately after blah.exe loaded, not after it was ended.
> 
> Thanks.
> 
> Zve

`start blah.exe`

Note the ` , it’s not a '.

Regards,

Siep

---

<div class="post-metadata">

**Author:** ![Victor\_SZverokS\_She](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/46a35a/32.png) [@Victor\_SZverokS\_She](https://www.ruby-forum.com/u/Victor_SZverokS_She)\
**Post date:** [February 22, 2008, 6:23pm UTC](https://www.ruby-forum.com/t/run-the-program-and-return-immediately/129918/3 "2008-02-22T18:23:20Z")

</div>

Victor ‘Zverok’ Shepelev wrote:

> Thanks.
> 
> Zve

One way:

t = Thread.new do  
system(“blah.exe”)  
end

#do other stuff

t.join

Traditional fork and exec way:

child\_pid = fork  
exec(“blah.exe”) unless child\_pid

#do stuff

Process.wait # or Process.detach

I believe this should work fine on Windows.

-Justin
