I want to send and receive commands like "dir" and so on but i can't manage to read the output
-
code please. Did you look at the Process class and other questions on SO related to reading output from it?NG.– NG.2010-04-09 17:14:03 +00:00Commented Apr 9, 2010 at 17:14
-
Please remember to accept the answer you found most helpful. This will ensure that you get help in the future.Gabriel McAdams– Gabriel McAdams2010-04-09 17:20:30 +00:00Commented Apr 9, 2010 at 17:20
-
when i try to "thank" someone i get "You can't vote for your own post." i think it's cuz i'm new hereuser302823– user3028232010-04-09 22:06:56 +00:00Commented Apr 9, 2010 at 22:06
-
There is a check mark that appears to the left of each person's answer. To accept an answer, click the one next to the answer you found most helpful.Gabriel McAdams– Gabriel McAdams2010-04-10 18:40:08 +00:00Commented Apr 10, 2010 at 18:40
-
oh dear god how i missed it -.-user302823– user3028232010-04-10 19:34:06 +00:00Commented Apr 10, 2010 at 19:34
Add a comment
|
3 Answers
You have to redirect std in and std out. Once you do that, in C#, use the console as you would if you were writing a console app.
http://msdn.microsoft.com/en-us/library/3x859hf2(vs.71).aspx
Comments
If you are trying to execute an external application and capture the output you should look at this. The System.IO namespace has Directory, File, and Path classed which avoid the need to use external applications to enumerate directories.
Comments
You should not use console commands from code unless you really need to. (Hint: You don't)
You're looking for Directory.GetFiles.