473,396 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

running DOS Commands from C#

I have a DOS application that I want to run from within my Windows C#
application (eg. c:\> DOSApp "hello"). is it possible?
Thanks.
Nov 15 '05 #1
4 1858
news.microsoft.com wrote:
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

Nov 15 '05 #2
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" <VM> wrote in message
news:uX**************@TK2MSFTNGP09.phx.gbl...
I have a DOS application that I want to run from within my Windows C#
application (eg. c:\> DOSApp "hello"). is it possible?
Thanks.

Nov 15 '05 #3
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 [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:OR**************@tk2msftngp13.phx.gbl...
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" <VM> wrote in message
news:uX**************@TK2MSFTNGP09.phx.gbl...
I have a DOS application that I want to run from within my Windows C#
application (eg. c:\> DOSApp "hello"). is it possible?
Thanks.


Nov 15 '05 #4
Set the WorkingDirectory property.

VM

"news.microsoft.com" <VM> wrote in message
news:uT**************@TK2MSFTNGP10.phx.gbl...
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 [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:OR**************@tk2msftngp13.phx.gbl...
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" <VM> wrote in message
news:uX**************@TK2MSFTNGP09.phx.gbl...
I have a DOS application that I want to run from within my Windows C#
application (eg. c:\> DOSApp "hello"). is it possible?
Thanks.



Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Will Seay | last post by:
At the end of this message I've pasted a script we're trying to modify slightly. I don't believe it is VBscript or javascript but these are the closest groups I could find with my limited...
9
by: Brian Roberts | last post by:
I have a command line Python program that sometimes takes a bit (several minutes) to run. I want to provide an optional method for an impatient user (me!) to check the status of the program. The...
1
by: stealthwang | last post by:
I'm still very new to Python, after decideding to learn a true programming language (rather then a scripting language, i like to think i'm a intermediate PHP user). I decided for my first project I...
8
by: Paul Cochrane | last post by:
Hi all, I've got an application that I'm writing that autogenerates python code which I then execute with exec(). I know that this is not the best way to run things, and I'm not 100% sure as to...
9
by: kapsi | last post by:
Hey all, I was just wondering as to how to implement dos commands and windows commands using the C language? any ideas?
0
by: Mr Bounce | last post by:
Hi, Probably well worn ground, this, but im stumped and need some help, if you could: I'm trying to write some code for a windows service that needs to run in the background polling a server...
2
by: Franck Diastein | last post by:
Hi, I'm designing an application, and I would like to be able to receive external commands... I would like a behavior like eMule, when you click on an ed2k link, the link is added to eMule, even...
14
by: miago | last post by:
Searching this forum I found an example of running Unix commands from Python;I wonder if there is a way to get the output of windows commands on a string using Python.Thanks in advance; Miago.
6
by: Mike | last post by:
I'm having trouble running TSQL commands when SQL2005 is in single- user mode. I've restarted SQL with -m, -c, -T3608 set in the startup options. I can get into Config manager OK, but as soon...
4
by: SPJ | last post by:
Is it possible to run specific commands on cisco router using Python? I have to run command "show access-list" on few hundred cisco routers and get the dump into a file. Please let me know if it is...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.