# Win32ole

**URL:** <https://www.ruby-forum.com/t/win32ole/94218>\
**Category:** Ruby\
**Created:** [April 25, 2006, 9:05pm UTC](https://www.ruby-forum.com/t/win32ole/94218 "2006-04-25T21:05:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yeungsprite](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ea5d25/32.png) [@yeungsprite](https://www.ruby-forum.com/u/yeungsprite)\
**Post date:** [April 25, 2006, 9:05pm UTC](https://www.ruby-forum.com/t/win32ole/94218/1 "2006-04-25T21:05:10Z")

</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!

---

<div class="post-metadata">

**Author:** ![yeungsprite](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ea5d25/32.png) [@yeungsprite](https://www.ruby-forum.com/u/yeungsprite)\
**Post date:** [April 25, 2006, 11:52pm UTC](https://www.ruby-forum.com/t/win32ole/94218/2 "2006-04-25T23:52:39Z")

</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|  
puts f.Name, f.Type, f.Size  
end

Search [msdn.microsoft.com](http://msdn.microsoft.com) for “Scriptable Shell Objects” for more  
details.

Mully
