Running command line commands with parameters read from a text fil

  • Thread starter Thread starter orit
  • Start date Start date
O

orit

I am trying unsuccessfully to implement the following:
Run a command in command line (cmd.exe) while the command will use parameter
read from a text file.
The user will select the file to read in a winform and the same command will
run in a loop while using in each run the value in 1 single line in the text
file.

Can someone please advise what is the best way to do that?

Thanks a lot
 
Are you trying to have your window form application use a text file
when it starts? Couldn't you pass the path to the text file and
receive it in static Main(string[] args) ?
 
Are you trying to have your window form application use a text file
when it starts? Couldn't you pass the path to the text file and
receive it in static Main(string[] args) ?

I am trying unsuccessfully to implement the following:
Run a command in command line (cmd.exe) while the command will use parameter
read from a text file.
The user will select the file to read in a winform and the same command will
run in a loop while using in each run the value in 1 single line in the text
file.
Can someone please advise what is the best way to do that?
Thanks a lot

Using StreamReader to read line per line, you can run a command with
Process class (http://msdn.microsoft.com/en-us/library/
system.diagnostics.process.aspx). Loop through txt lines concatening
the parameter to your command and run the process, till it ends
(WaitForExit).

Hope it help

Thiago
 
Back
Top