0
Call command in c#
How can you call a command of cmd in c#? Like you do os.system("dir") in python?
8 Respuestas
0
Here's a link to a similar question:
https://stackoverflow.com/questions/206323/how-to-execute-command-line-in-c-get-std-out-results
It almost sounds like you are trying to run python code from C#, and get the standard out. That link should help you.
0
You want to use System.Diagnostics.Process.Start("cmd.exe", yourCommandHere);
Edit: The more I think about this, the more I think you may want to use something from AppDomain and not send commands to the command prompt. What are you trying to do?
0
Matthew Shoop, this brings up a window
0
Yes it does. Which is why I think you don't actually want to pass commands to cmd. Try System.IO.Directory.GetFiles instead of dir.
0
I am trying to do two custom commands.
1) One that will do some calculation and save it to a file.
2) Another one which I will need to read from cmd.
0
So you are using the File class to write to your file. Now you just need to read cmd output from what command? There is almost certainly a class for it.
0
No, there is two different commands I made in other languages.
0
It works! Thanks!