Reputation: 61
Can i programatically compile a batch file form c#. Meaning that I give the location of the file and some C# Library compiles the file and gives the output
Can anyone tell me the library for C# that can help me write a small intepreter for C#
Upvotes: 0
Views: 522
Reputation: 499132
Batch files in windows do not get compiled. They get executed by a command processor.
You can use Process.Start
to execute a batch file from within a C# program.
Upvotes: 3
Reputation: 60518
If I assume this is just a regular windows batch file, you could run it like this:
System.Diagnostics.Process.Start('myfile.bat');
That will return a Process
object. From there you can get the output stream from the process and read whatever text the batch file writes to the console.
Upvotes: 1