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")
精彩评论