Show a folder with a file selected

private void Form1_Load(object sender, System.EventArgs e)
{
 ShowFile("C:\\config.sys");
}

private void ShowFile(string PathAndFilename)
{
 FileInfo FileData = My.Computer.FileSystem.GetFileInfo(PathAndFilename);
 if (FileData.Exists == true) {
  Process.Start("explorer.exe", "/select," + FileData.FullName);
 }
}

No comments:

Post a Comment