This can be a handy functionality to have in a program that works with files/folders. It’s easy enough to actually open the containing folder using:
System.Diagnostics.Process.Start( *path to folder* );
…but how do I go about actually selecting the target file within that parent folder? If I use the Process.Start method it actually attempts to open the file.
According to Windows Explorer Command-Line Options you just need to start an
explorerprocess with/selectparameter.For instance, ‘
explorer /select,c:\Windows‘ will open a window withc:\windowsfolder selected.So simply
Process.Start("explorer.exe", "/select," + filename)should be enough.