# Win32ole

**URL:** <https://rubytalk.org/t/win32ole/26929>\
**Category:** ruby-talk\
**Created:** [25 April 2006 19:05 UTC](https://rubytalk.org/t/win32ole/26929 "2006-04-25T19:05:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yeungsprite](https://avatars.discourse-cdn.com/v4/letter/y/ea5d25/32.png) [@yeungsprite](https://rubytalk.org/u/yeungsprite)\
**Post date:** [25 April 2006 19:05 UTC](https://rubytalk.org/t/win32ole/26929/1 "2006-04-25T19:05:14Z")

</div>

Hello, I am new to Ruby and Windows programming and have a question  
regarding the WIN32OLE. The following sample code is used to launch MS  
Internet Explorer.

require 'win32ole'  
ie = WIN32OLE.new('InternetExplorer.Application')  
ie.visible = true  
ie.gohome

What I would like to do is launch MS Windows Explorer (file manager /  
Windows GUI Shell) and determine the functions to call to traverse it  
(ie expand branches, open files, etc) for automation purposes.

Can anyone suggest resources on how to accomplish this?

Thanks very much!

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![David\_Mullet](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@David\_Mullet](https://rubytalk.org/u/David_Mullet)\
**Post date:** [25 April 2006 21:52 UTC](https://rubytalk.org/t/win32ole/26929/2 "2006-04-25T21:52:48Z")

</div>

yeungsprite wrote:

> Hello, I am new to Ruby and Windows programming and have a question  
> regarding the WIN32OLE. The following sample code is used to launch MS  
> Internet Explorer.
> 
> require 'win32ole'  
> ie = WIN32OLE.new('InternetExplorer.Application')  
> ie.visible = true  
> ie.gohome
> 
> What I would like to do is launch MS Windows Explorer (file manager /  
> Windows GUI Shell) and determine the functions to call to traverse it  
> (ie expand branches, open files, etc) for automation purposes.
> 
> Can anyone suggest resources on how to accomplish this?
> 
> Thanks very much!

The Windows Shell object may serve your purpose and is accessible via  
COM (win32ole). A simple example:

ws = WIN32OLE.new("Shell.Application")  
folder = ws.NameSpace("C:\\Temp")  
folder.Items.each do |f|  
&nbsp;&nbsp;puts f.Name, f.Type, f.Size  
end

Search msdn.microsoft.com for "Scriptable Shell Objects" for more  
details.

Mully

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
