Large Posted August 2, 2004 Share Posted August 2, 2004 I am using the line of code below to open My Computer from a button on my form, but when I click the button it opens My Documents. System.Diagnostics.Process.Start("explorer.exe", Environment.GetFolderPath(17)) Why does it open My Documents when special folder 17 is My Computer ? Any help much appreciated. :happy: Link to comment Share on other sites More sharing options...
0 +primortal Subscriber² Posted August 2, 2004 Subscriber² Share Posted August 2, 2004 try Environment.GetFolderPath(Environment.SpecialFolder.Personal) Link to comment Share on other sites More sharing options...
0 Large Posted August 2, 2004 Author Share Posted August 2, 2004 Nope, I just tried what you suggested, the personal folder is the My Documents folder, I'm after My Computer ! The following code opens the My Documents folder which don't make sense. Dim mycomp As String mycomp = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer) System.Diagnostics.Process.Start("explorer.exe", mycomp) Any other suggestions ? Link to comment Share on other sites More sharing options...
0 Large Posted August 2, 2004 Author Share Posted August 2, 2004 Does anyone know how to open My Computer from a button ? Please help if you can ! Link to comment Share on other sites More sharing options...
0 Prince21 Posted August 2, 2004 Share Posted August 2, 2004 It could be a beta bug, you never know? Link to comment Share on other sites More sharing options...
0 Large Posted August 2, 2004 Author Share Posted August 2, 2004 It could be a beta bug, you never know? Heh, How on earth can it be a beta bug ? :huh: I'm using VB.Net 2003 !!! Link to comment Share on other sites More sharing options...
0 Large Posted August 2, 2004 Author Share Posted August 2, 2004 (edited) This one really has me stumped !!! Edited August 2, 2004 by Large Link to comment Share on other sites More sharing options...
0 Winston Posted August 3, 2004 Share Posted August 3, 2004 Heh, How on earth can it be a beta bug ? :huh:I'm using VB.Net 2003 !!! Not BETA, but it can be a bug... if it's final it doesn't mean it's bug free, like Application.EnableVisualStyles() has many problems at times, and i prefer to still stick with using my manifest file. Link to comment Share on other sites More sharing options...
0 smurfiness Posted August 3, 2004 Share Posted August 3, 2004 Well, okay, think about what you're actually doing here. The prototype for Process.Start is: Process.Start(filename,arguments) Arguments is a string, but you're passing it SpecialFolders.MyComputer, which would translate to either "System.Enum" or "17" as a string, neither of which explorer.exe takes as a parameter. You may not be able to open My Computer in an explorer window from the command line, since "My Computer" is not an actual path on the system. (I couldn't find any way to do this) Link to comment Share on other sites More sharing options...
0 Gumboot Posted August 3, 2004 Share Posted August 3, 2004 The command line to open an explorer window showing My Computer is: %systemroot%\explorer.exe /e,::{20D04FE0-3AEA-1069-A2D8-08002B30309D} or, without the tree-view pane to the left: %systemroot%\explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D} Link to comment Share on other sites More sharing options...
0 Large Posted August 3, 2004 Author Share Posted August 3, 2004 Yeah dannysmurf perhaps that is the case because as you say My Computer is not an actual folder on the system. Thanks Gumboot, I may be able to do it using that info, I'll try later and let you know how I get on. Link to comment Share on other sites More sharing options...
0 Gumboot Posted August 3, 2004 Share Posted August 3, 2004 Try this: System.Diagnostics.Process.Start("explorer.exe", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}") Link to comment Share on other sites More sharing options...
Question
Large
I am using the line of code below to open My Computer from a button on my form, but when I click the button it opens My Documents.
System.Diagnostics.Process.Start("explorer.exe", Environment.GetFolderPath(17))Why does it open My Documents when special folder 17 is My Computer ?
Any help much appreciated. :happy:
Link to comment
Share on other sites
11 answers to this question
Recommended Posts