如果您只想运行桌面应用程序(例如记事本、写字板、Internet Explorer 等),请执行以下操作工艺方法 http://msdn.microsoft.com/en-us/library/2y3s566a.aspx and 进程启动信息类 http://msdn.microsoft.com/en-us/library/bfbyhds5%28v=vs.90%29.aspx
try
{
// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "C:\Path\To\App.exe";
p.Start();
}
// Exp 2
// Uses the ProcessStartInfo class to start new processes,
// both in a minimized mode.
void OpenWithStartInfo()
{
ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(startInfo);
startInfo.Arguments = "www.northwindtraders.com";
Process.Start(startInfo);
}
在 Windows 8 Metro 应用程序上我发现了这一点:如何开始
Metro 应用程序的外部程序 http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/14e2be68-ef86-4480-a3fd-6ddf7ec7d1f1.
所有 Metro 风格的应用程序都在高度沙盒中运行
环境,没有办法直接启动外部
应用。
您可以尝试使用发射器类 http://msdn.microsoft.com/en-us/library/windows/apps/br241801.aspx– 取决于您的需要
为您提供可行的解决方案。
检查一下:
我可以使用 Windows.System.Launcher.LauncherDefaultProgram(Uri) 调用另一个 Metro 风格应用程序吗? http://social.msdn.microsoft.com/Forums/nl-NL/winappswithhtml5/thread/b38bb2de-2a05-4f7d-8547-48b9759d72d4
Ref: 如何从 Metro 应用程序中启动桌面应用程序? http://social.msdn.microsoft.com/Forums/en-US/windowsdeveloperpreviewgeneral/thread/e74cce2d-9a1f-4bf9-a5f2-733c15e4f297
Metro IE 是一个特殊的应用程序。您无法从 Metro 风格应用程序调用可执行文件。
试试这个 - 我还没有测试过,但可能会对你有帮助..
Launcher.LaunchFileAsync http://msdn.microsoft.com/en-us/library/windows/apps/hh701465.aspx#Y0
// Path to the file in the app package to launch
string exeFile = @"C:\Program Files (x86)\Steam\steamapps\common\Skyrim\TESV.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 launch failed
}
}