Home > C#, utils > Programaticaly opening folder

Programaticaly opening folder

A method to programaticaly opening folder with explorer:

string folderToOpen = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\archive";
string windir = Environment.GetEnvironmentVariable("SystemRoot");
System.Diagnostics.Process proccess = new System.Diagnostics.Process();
proccess.StartInfo.FileName = windir + @"\explorer.exe";
proccess.StartInfo.Arguments = folderToOpen;
proccess.Start();
[/c-sharp]

String variable folderToOpen contains path to “archive” folder under this folder in which the program works.
proccess.StartInfo.FileName contains path to “windows explorep”.


Unique visitors to post: 0

Categories: C#, utils Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.
Google Analytics integration offered by Wordpress Google Analytics Plugin