Process.Start("MyComputer");

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I'm trying to launch an instance of explorer from windows that will
default to the "My Computer" branch.

Any suggestions? I've tried:
string myComp = Environment.SpecialFolder.MyComputer.ToString();
System.Diagnostics.Process.Start(myComp);
which fails, is there a special folder that i can give to explorer as an
argument?
Thanks
 
Hi Rob,

You use the Environment.GetFolderPath method to retrieve the path for a
special folder. But this method would give you an empty string if you pass
MyComputer, since there is not physical path associated with it.

Also, I feel that when you open explorer.exe, the current selection would be
by default "MyComputer".

I am wondering where you are facing an issue in this.
 
Just running explorer launches it into the my documents folder, is there no
way of looking up the virtual folder name?
 
Hello Rob,

You can try one of the following command lines:
explorer /e,,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

The CLSID is the one of My Computer. The /e option tells the explorer to use "explorer view" instead of "folder view".

Regards

"Rob White" <[email protected]> escribió en el mensaje | Hi, I'm trying to launch an instance of explorer from windows that will
| default to the "My Computer" branch.
|
| Any suggestions? I've tried:
| string myComp = Environment.SpecialFolder.MyComputer.ToString();
| System.Diagnostics.Process.Start(myComp);
| which fails, is there a special folder that i can give to explorer as an
| argument?
| Thanks
 
That's exactly what I was after. Thanks.

Is there somewhere that you used as a reference for this kind of stuff, or
did you just go trawling through the registry for explorer related stuff?
 
Hi Rob,

| Is there somewhere that you used as a reference for this kind of stuff, or
| did you just go trawling through the registry for explorer related stuff?

I found it in a knowledge base article that explained the command line options of explorer.exe in the times of Windows 95. I found also other useful CLSID's, but since then I haven't looked for new ones.

{208D2C60-3AEA-1069-A2D7-08002B30309D} Network Neighborhood
{20D04FE0-3AEA-1069-A2D8-08002B30309D} My Computer
{21EC2020-3AEA-1069-A2DD-08002B30309D} Control Panel
{2227A280-3AEA-1069-A2DE-08002B30309D} Printers
{450D8FBA-AD25-11D0-98A8-0800361B1103} My Documents
{645FF040-5081-101B-9F08-00AA002F954E} Recycle Bin
{D6277990-4C6A-11CF-8D87-00AA0060F5BF} Tasks

Some of them may not work or may be version dependant...
I suppose that any CLSID with a ShellFolder subkey in the registry may be used.

This CLSID's are used in a number of ways: NameSpace registry entries for My Computer, Desktop, Network Neighborhood, etc., desktop.ini files or file and folder filename extensions. Try to create a folder with this name:
New Folder.{21EC2020-3AEA-1069-A2DD-08002B30309D}
When you open it you have the Control Panel.

This special shell folders have attributes that are enumerated as SFGAO_* in the Platform SDK and are documented here:
http://msdn.microsoft.com/library/d...s/ishellfolder/GetAttributesOf.asp?frame=true

For example:
[HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\ShellFolder]
"Attributes"=hex:50,01,00,20 ;Now you can rename the Recycle Bin.


Regards.
 
Back
Top