如何从Win 8应用程序启动进程?

我找不到System.Diagnostics.Process来启动新进程。 我想这是故意的。 但还有另外一种方法吗? 这有可能吗?

您可以在Windows 8 Metro应用程序中使用此参考: 如何从Metro App启动外部程序 。 所有Metro风格的应用程序都在高度沙盒环境中工作,无法直接启动外部应用程序。

您可以尝试使用Launcher类

  1. Launcher.LaunchFileAsync

    // Path to the file in the app package to launch string exeFile = @"C:\Program Files (x86)\App.exe"; var file = await Windows.ApplicationModel.Package.Current.InstalledLocation .GetFileAsync(exeFile); if (file != null) { // Set the option to show the picker var options = new Windows.System.LauncherOptions(); options.DisplayApplicationPicker = true; // Launch the retrieved file bool success = await Windows.System.Launcher.LaunchFileAsync(file, options); if (success) { // File launched } else { // File launching failed } } 
  2. Launcher.LaunchUriAsync

参考: 我可以使用Windows.System.Launcher.LauncherDefaultProgram(Uri)来调用另一个metro风格的应用程序吗?

看起来无法打开任何非地铁流程。 您可以打开* .txt等URL或文件,但不能打开* .cmd或* .exe。

如果有自定义文件关联,您可能(我没有尝试过)通过打开带有自定义文件扩展名的空文件来启动进程。 但您无法编辑注册表以添加应用程序中的关联。
所以没有App-Only方法来做到这一点(除了尚未发现的黑客;))。