Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

How to open a new "My Computer" explorer window in C#?

asasadadafaf (TechnicalUser) (OP)
18 Mar 08 23:59

My question is very simple, as subject, How to open a new "My Computer" explorer window in C#? Just like you double click "My Computer" icon on the desktop. I tried to search around google but have no clue how to do that?

Many thanks for your help

JurkMonkey (Programmer)
19 Mar 08 0:08
using System.Diagnostics;

public static void OpenWindow(string path)

    //If the above doesn't work try
    System.Diagnostics.Process.Start("explorer.exe", path);

asasadadafaf (TechnicalUser) (OP)
19 Mar 08 0:20
thanks, but how should i setup the path if i want to point it to "My computer"? i tried to put "My computer" as path but it doesn't work,many thanks
JurkMonkey (Programmer)
19 Mar 08 0:40
System.Diagnostics.Process.Start("explorer.exe", "");

asasadadafaf (TechnicalUser) (OP)
19 Mar 08 0:58
Thanks JurkMonkey, I tried this but it opens "My documents" instead, many thanks for your help!
JurkMonkey (Programmer)
19 Mar 08 1:41
I found that if you run explorer with no path it opens my documents but if you use empty string it opens My Computer.

That was on a Windows 2000 machine.

You may want to look into the Environment.SpecialFolder list and see if there's one for the computer path.

asasadadafaf (TechnicalUser) (OP)
19 Mar 08 3:18
Many thanks, i tried to do some research about Environment.SpecialFolder but it seems that this function will return a PAth actually, but you know "My computer" is not actually a Folder at all, and if i use this function for "My Computer" it will returns "blank" and leads going to "My documents" instead, any other hints for achieve this? many thanks again!
asasadadafaf (TechnicalUser) (OP)
19 Mar 08 4:05
i tried to put " " as path, now it works , many thanks!
phinoppix (Programmer)
19 Mar 08 23:55
Cool trick! =)  works on cmd line too (i'm running XP)!


earthandfire (Programmer)
20 Mar 08 1:02
In Vista you need:



Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close