Open a folder using Process.Start

后端 未结 14 2318
南笙
南笙 2020-11-30 22:56

I saw the other topic and I\'m having another problem. The process is starting (saw at task manager) but the folder is not opening on my screen. What\'s wrong?



        
14条回答
  •  盖世英雄少女心
    2020-11-30 23:13

    Just for completeness, if all you want to do is to open a folder, use this:

    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo() {
        FileName = "C:\\teste\\",
        UseShellExecute = true,
        Verb = "open"
    });
    

    Ensure FileName ends with Path.DirectorySeparatorChar to make it unambiguously point to a folder. (Thanks to @binki.)

    This solution won't work for opening a folder and selecting an item, since there doesn't seem a verb for that.

提交回复
热议问题