开发者

open a text file through cmd.exe in .net

I want to open one notepad file by using command prompt.I wrote this codes

  Process proc = new Process()开发者_开发知识库;
  ProcessStartInfo ps = new ProcessStartInfo("cmd.exe");
  ps.Arguments = "notepad E:\\Zlabel.txt";
  proc.StartInfo = ps;
  proc.Start();

But i am not getting the desired result. It is just opening cmd.


Just use: Process.Start("E:\\Zlabel.txt");

It should work ok. The file will be opened in the default viewer for the txt extension.

For Printing

You might use the Print command.

Process.Start("print E:\\Zlabel.txt")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜