C#中运行本地文件
Example:
OpenDoc("C:\\SomeDocumentation.pdf");
OpenDoc("C:\\AWebPage.htm", "EDIT");
OpenDoc("C:\\Test.txt", "PRINT");
System.Diagnostics.Process doc = OpenDoc("C:\\WebPage.htm");
public System.Diagnostics.Process OpenDoc(String Filename, String Verb)
{
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo( );
info.FileName = Filename;
info.UseShellExecute = true ;
info.Verb = Verb;
info.WindowStyle = System.Diagnostics .ProcessWindowStyle.Normal;
return System. Diagnostics.Process.Start(info);
}
public System.Diagnostics.Process OpenDoc (String Filename)
{
return OpenDoc (Filename, "OPEN");
}
没有评论:
发表评论