C#
윈도우에 등록된 확장자를 가진 파일 열기
네오팡
2011. 11. 16. 16:05
윈도우에 등록된 확장자를 가진 파일을 열고자 할 때 사용한다.
간단하게
간단하게
Process.Start(filePath);또는
private void OpenFile(string filePath) { try { System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(); info.RedirectStandardOutput = true; info.UseShellExecute = false; info.CreateNoWindow = true; info.FileName = "cmd"; info.Arguments = "/c \"" + filePath + "\""; //실행 후 cmd.exe를 종료한다. System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo = info; proc.Start(); //string result = proc.StandardOutput.ReadToEnd(); //MessageBox.Show(result); } catch (Exception ex) { MessageBox.Show(ex.Message); } }