Explorer.exe and Visual Basic.NET 2005

Explorer.exe and Visual Basic.NET 2005

As many of you know, explorer.exe is the Windows Program Manager or Windows Explorer. It manages the Windows Graphical Shell including the Start menu, taskbar, desktop, and File Manager. For example, if you were to open My Computer from your desktop, explorer.exe runs; if you were to open the Recycle Bin, explorer.exe runs again. In this article, I will explain how to launch the main desktop icons, some Control panel items, and more with explorer.exe and Visual Basic.NET 2005.

First, the Complicated Stuff

CLSID explained

A Class ID (CLSID) is a 128-bit (large) number that represents a unique ID for a software application or application component. Typically, the IDs are displayed like this: "{645FF040-5081-101B-9F08-00AA002F954E}". You can think of a CLSID as a social security number or Identification number for a piece of software, or a software component.

Windows uses CLSIDs to identify software components without having to know their names. They also can be used by software applications to identify a computer, file, or other item.

Why am I talking about CLSIDs?

The answer is simple. To execute/start the appropriate desktop or Control Panel item, with explorer.exe, you would need to specify the CLSID of the appropriate item so that explorer.exe knows which item you are launching.

OK, but where are these CLSIDs stored?

All CLSIDs are stored in the Registry, usually at HKEY_CLASSES_ROOT\CLSID. Some of the special CLSIDS can also be found in the Registry keys where the related namespace extensions are specified as in the key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\ CurrentVersion\Explorer\ControlPanel\NameSpace\ where you can find all CLSIDs related to the Control Panel.

Explorer.exe Explained

As mentioned earlier, explorer.exe is the Windows Program Manager, or Windows Explorer. It manages the Windows Graphical Shell including the Start menu, taskbar, desktop, and File Manager. For example, if you were to open My Computer from your desktop, explorer.exe runs; if you were to open the Recycle Bin, explorer.exe run again.

explorer.exe can be broken down into the following parts:

explorer [/n] [/e][,/root,object][[,/select],subobject]
Parameter Explanation
/n Always opens a new window (even if the specified folder is already open).
/e Uses Windows Explorer view. The default is Open view.
/root, object Specifies the object in the normal name space that will be used as the root of this Windows Explorer Folder. The default is to just use the normal name space root (the desktop).
/select Specifies that the parent folder is opened and the specified object is selected.
subobject Specifies the folder to receive the initial focus unless /select is used. The default is the root.

These parameters allow you to pass additional information to explorer.exe on how to function. For example, they tell you what to open, and in which view/mode to open them.


Say, for example, I want to open the My computer icon through explorer.exe. You have already established that you need to specify a CLSID to open, and as explained in the previous section, you have established that you need to pass certain parameters to explorer.exe as well.

To open My Computer, you can do the following:

  1. Click the Start Button on the Windows Start Menu.
  2. Select Run.
  3. Enter the following:
  4. explorer.exe /n,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
  5. Click OK.

The above code will open the My Computer icon (with a CLSID of {20D04FE0-3AEA-1069-A2D8-08002B30309D}) in a new window (/n).

Here's another example:

  1. Click the Start Button on the Windows Start Menu.
  2. Select Run.
  3. Enter the following:
  4. explorer.exe /n, /e,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
  5. Click OK.

The above code will open the My Computer icon (with a CLSID of {20D04FE0-3AEA-1069-A2D8-08002B30309D} ) in a new window (/n), in Windows Explorer View. In other words, it will give you the Folder & Drive Pane on the left side as well the the Files pane on the right side (/e).

Running explorer.exe from Visual Basic.NET 2005

To run explorer.exe with or without additional parameters, you will need to use the Process class. This class provides access to local and remote processes and enables you to start and stop local system processes.

A Process object provides access to a process that is running on a computer. A process, in the simplest terms, is a running application. A thread is the basic unit to which the operating system allocates processor time.

To start a Process, you can use the Start method from the Process class; you also can include the StartInfo parameter that members can use to duplicate the functionality of the Run dialog box of the Windows Start menu. Anything that can be typed into a command line can be started by setting the appropriate values in the StartInfo property. The only StartInfo property that must be set is the FileName property. The FileName property does not have to be an executable file. It can be of any file type for which the extension has been associated with an application that is installed on the system. For example, the FileName property can have a .txt extension if you have associated text files with an editor, such as Notepad, or it can have a .doc extension if you have associated .doc files with a word processing tool, such as Microsoft Word.

In the command line, you can specify actions to take for certain types of files. For example, you can print documents or edit text files. Specify these actions using the Verb member of the StartInfo property. For other types of files, you can specify command line arguments when you start the file from the Run dialog box. For example, you can pass a URL as an argument if you specify your browser as the FileName. These arguments can be specified in the StartInfo property's Arguments member.

Explorer.exe and Visual Basic.NET 2005

Putting Everything Together

Opening My Computer

'My Computer
Process.Start("explorer.exe", "/n, _

Opening Windows Explorer

'Windows Explorer
Process.Start("explorer.exe", "/n,/e,C:\")

By specifying C:\ here, Windows Explorer will open (/select) the C:\ drive automatically once opened.

Opening My Computer in Windows Explorer view

'My Computer in Windows Explorer View
Process.Start("explorer.exe", "/n, /e, _

Opening the Recycle Bin

'Recycle Bin
Process.Start("explorer.exe", "/n, _

Opening Network Neighborhood

'Network Neighborhood
Process.Start("explorer.exe", "/n, _

Opening My Documents

'My Documents
Process.Start("explorer.exe", "/n, _

Opening My Documents in Windows Explorer view

'My Documents In Windows Explorer
Process.Start("explorer.exe", "/n, /e, _

By specifying /e, you display the My Documents folder in the Windows Explorer view.

Opening the Default Internet Browser

'Default Browser
Process.Start("explorer.exe", "/n, _

This should open the default Internet browser.

Opening the Control Panel

'Control Panel
Process.Start("explorer.exe", "/n, _
   ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\ _

This is where it may get tricky. If you look closely at the above statement, you will notice that it references the CLSID of My Computer and then another CLSID at the back. This is because the Contol Panel is a subobject of My Computer; that is why you will notice the backslash separating the two. Think of it as an ordinary path. Imagine opening My Computer by double-clicking on it, and then selecting Control Panel from within the My Computer window.

Opening Printers and Faxes

'Printers And Faxes
Process.Start("explorer.exe", "/n, _
   ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\ _

This statement works basically the same as the statement opening the Control Panel. This time, however, you reference the Printers and Faxes' CLSID in conjunction with My Computer's CLSID.

Opening Scanners & Cameras

'Scanners & Cameras
Process.Start("explorer.exe", "/n, _
   ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\ _
   ::{21EC2020-3AEA-1069-A2DD-08002B30309D}\ _

Now it gets even worse, LOL! Not really. Remember the path scenario I spoke about earlier? This is the same. The above statement can be translated to:

My Computer \ Control Panel \ Scanners and Cameras

Scanners and Cameras is one of your Control Panel items in My Computer.

Opening Fonts

Process.Start("explorer.exe", "/n, _
   ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\ _
   ::{21EC2020-3AEA-1069-A2DD-08002B30309D}\ _

My Computer \ Control Panel \ Fonts

Opening Web Folders

'Web Folders
Process.Start("explorer.exe", "/n, _
   ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\ _

Opens the Web Folders folder.

Opening Tasks

'Tasks Scheduler
Process.Start("explorer.exe", "/n, _
   ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\ _

Opens Task Scheduler.

Opening Admin Tools

'Administration Tools
Process.Start("explorer.exe", "/n, _
   ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\ _
   ::{21EC2020-3AEA-1069-A2DD-08002B30309D}\ _

Opens the Administrative Tools.

Opening Files Search results

'Results Of Search
Process.Start("explorer.exe", "/n, _

This will open the Windows Search Results window.


I hope that you have enjoyed reading this article, and most importantly, that you now understand how explorer.exe works, and how you can utilise its power in your applications.

About the Author

Hannes du Preez

Hannes du Preez is a Microsoft MVP for Visual Basic. He is a trainer at a South African-based company. He is the co-founder of hmsmp.co.za, a community for South African developers.



  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date