只需要使用Process.Start启动外部进程打开指定路径即可。比如:
private async void OnOpenAppDirectory(object sender, RoutedEventArgs e) { var directory = AppFramework.GetRuntimeApplicationDirectory(); try { if (OperatingSystem.IsWindows()) { Process.Start("explorer.exe", $"\"{directory}\""); } else if (OperatingSystem.IsMacOS()) { Process.Start("open", $"\"{directory}\""); } } catch(Exception ex) { await MessageBoxUtils.ShowWarningAsync(this, "Warning", ex.Message); } }
Windows下启动explorer.exe,MacOS下启动open 即可。
标签:Process,MacOS,Explorer,C#,Start,Windows,ex,directory From: https://www.cnblogs.com/bodong/p/17245487.html