# Windows executables

**URL:** <https://www.ruby-forum.com/t/windows-executables/126509>\
**Category:** Ruby\
**Created:** [January 18, 2008, 9:12pm UTC](https://www.ruby-forum.com/t/windows-executables/126509 "2008-01-18T21:12:18Z")\
**Posts on this page:** 2\
**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:** [January 18, 2008, 9:12pm UTC](https://www.ruby-forum.com/t/windows-executables/126509/1 "2008-01-18T21:12:18Z")

</div>

How can I make my script run directly on the command line in windows  
like ruby is?  
ruby -w myscript.rb -o  
myscript -o

---

<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:** [January 18, 2008, 9:27pm UTC](https://www.ruby-forum.com/t/windows-executables/126509/2 "2008-01-18T21:27:09Z")

</div>

On Jan 18, 2008 2:11 PM, removed\_email\_address@domain.invalid  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How can I make my script run directly on the command line in windows like ruby is?  
> ruby -w myscript.rb -o  
> myscript -o

If you’re using one of the latest one-click installers, this should  
already work for you. Here are some things to check.

# make sure the path to ruby.exe is in your path system environment

variable  
C:\>path  
PATH=c:\ruby\ruby186\bin;C:\WINDOWS;C:\WINDOWS\System32\Wbem

# make sure .rb and .rbw are set in the pathext system environment

variable

# if you need to change a system environment variable, make sure you

# set it in the gui, and not with the set command. Otherwise the

# changes won’t persist.

# Here’s some info on how to do that:

[http://support.microsoft.com/kb/310519](http://support.microsoft.com/kb/310519)

C:\>echo %pathext%  
.COM;.EXE;.BAT;.CMD;.RB;.RBW;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.tcl;.PSC1

# make sure the file associations are there.

C:\>assoc .rb  
.rb=rbFile

C:\>ftype rbfile  
rbfile=c:\ruby\ruby186\bin\ruby.exe “%0” %\*
