INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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#?

Share

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

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

(OP)
Hi,

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

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

using System.Diagnostics;

public static void OpenWindow(string path)
{
    System.Diagnostics.Process.Start(path);

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

http://www.ubuntu.com/

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

(OP)
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

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

System.Diagnostics.Process.Start("explorer.exe", "");

http://www.ubuntu.com/

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

(OP)
Thanks JurkMonkey, I tried this but it opens "My documents" instead, many thanks for your help!

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

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.

http://www.ubuntu.com/

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

(OP)
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!

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

(OP)
i tried to put " " as path, now it works , many thanks!

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

Cool trick! =)  works on cmd line too (i'm running XP)!

c:\>explorer<space><space><enter>

wink

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

In Vista you need:

C:\>explorer,<enter>

vampirebat

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!

Resources

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