The Process class in System.Diagnostics allows you to launch a new process.
For security reasons, the Process class is not available in the
Metro profile, and you cannot start arbitrary processes. Instead,
you must use the Windows.System.Launcher class to “launch” a
URI or file to which you have access, e.g.:
Launcher.LaunchUriAsync (new Uri ("http://albahari.com"));
var file = await KnownFolders.DocumentsLibrary.GetFileAsync ("foo.txt");
Launcher.LaunchFileAsync (file);
This opens the URI or file, using whatever program is associated
with the URI scheme or file extension. Your program must be
in the foreground for this to work.
The static Process.Start method has a number of overloads; the simplest accepts a
simple filename with optional arguments:
Process.Start ("notepad.exe");
Process.Start ("notepad.exe", "e:\\file.txt");
You can also specify just a filename, and the registered program for its extension
will be launched:
Process.Start ("e:\\file.txt");
打开文件或者uri的方式--------进程启动文件和启动者启动文件
最新推荐文章于 2024-02-04 16:58:17 发布