• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

Locate Directory on Hard disk....

I am looking to "locate file in folder", I have the Directory Path, and filename, how would I open windows explorer the that folder with that filename highlighted?
0
addicktz
Asked:
addicktz
2 Solutions
 
Fahad MukhtarDistinguished EngineerCommented:
System.Diagnostic.Process.Start(DirectoryPath)
will do the half job

0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Use the "/select" switch for explorer.exe:

        private void button1_Click(object sender, EventArgs e)
        {
            String fileName = @"C:\Documents and Settings\Michael\My Documents\someFile.txt";
            System.Diagnostics.Process p = new Process();
            p.StartInfo.FileName = "explorer.exe";
            p.StartInfo.Arguments = @"/select," + fileName;
            p.Start();
        }
0
 
addicktzAuthor Commented:
i love you guys *tear*
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now