Implement “Open Containing Folder” and highlight file

后端 未结 3 768
北荒
北荒 2020-12-28 16:20

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.         


        
3条回答
  •  醉梦人生
    2020-12-28 16:34

    Containing folder, Self directory is represented in many ways!!! Simple 2 ways are . and, .\. no idea what is the difference!.. :D From DOS and bat files... Start . or Start .\. (Y)

    Try... these 2 works, but check whether this is the solution u expect!

    System.Diagnostics.Process.Start("explorer.exe", @".\.");
    

    Or

    System.Diagnostics.Process.Start("explorer.exe", @".");
    

    -

    • Sometimes the application is run from a temp directory or a different dir (eg: in Sandbox... or while being scanned by antivirus... etc. :)

提交回复
热议问题