Running command line commands with parameters read from a text fil

Running command line commands with parameters read from a text fil

Post by b3Jpd » Sun, 27 Apr 2008 02:07:01


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
 
 
 

Running command line commands with parameters read from a text fil

Post by Hayato Iri » Mon, 28 Apr 2008 14:37:14

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) ?

 
 
 

Running command line commands with parameters read from a text fil

Post by Thiago Mac » Fri, 02 May 2008 03:50:25


Using StreamReader to read line per line, you can run a command with
Process class ( http://www.yqcomputer.com/
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