running DOS Commands from C#

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

I have a DOS application that I want to run from within my Windows C#
application (eg. c:\> DOSApp "hello"). is it possible?
Thanks.
 
news.microsoft.com said:
I have a DOS application that I want to run from within my Windows C#
application (eg. c:\> DOSApp "hello"). is it possible?
Thanks.

System.Diagnostics.Process...

Tom Shelton
 
Yes, it is. You will want to call the static Start method on the
Process class. This will run your DOS program and you can optionally wait
for the end of the execution or continue to process while the process runs
in the background.

Hope this helps.
 
If my DOS app reads a text file during execution that's in the directory
where the EXE is, will it be able to read it? The problem is that during
execution, it tells me that it's not finding the config file necessary to
run the application (Error opening file...).


Nicholas Paldino said:
Yes, it is. You will want to call the static Start method on the
Process class. This will run your DOS program and you can optionally wait
for the end of the execution or continue to process while the process runs
in the background.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com

news.microsoft.com said:
I have a DOS application that I want to run from within my Windows C#
application (eg. c:\> DOSApp "hello"). is it possible?
Thanks.
 
Set the WorkingDirectory property.

VM

news.microsoft.com said:
If my DOS app reads a text file during execution that's in the directory
where the EXE is, will it be able to read it? The problem is that during
execution, it tells me that it's not finding the config file necessary to
run the application (Error opening file...).


in message news:[email protected]...
Yes, it is. You will want to call the static Start method on the
Process class. This will run your DOS program and you can optionally wait
for the end of the execution or continue to process while the process runs
in the background.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com

news.microsoft.com said:
I have a DOS application that I want to run from within my Windows C#
application (eg. c:\> DOSApp "hello"). is it possible?
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top