View Single Post
Old 11-07-2018, 11:58 AM   #1
u0206397
Senior Member
 
Join Date: Jul 2009
Posts: 761
Scripting to run command line tools

I have a CSV file containing data used to invoke a command line tool.

Example of CSV:

name,value
john
,1
robert
,2
michael
,3
william
,4
patricia
,5
jennifer
,6
linda
,7
elizabeth
,

The command line would look like this:

process_data.exe -name "john" -value 1 -"line_0001.dat"

... repeat ...

process_data.exe -name "elizabeth" -value 8 -"line_0008.dat" 
What is the easiest/elegant way to repeatedly execute a Windows command line program and vary the input parameters and output file name, hopefully without installing any complicated run time or interpreter environment?

Normal batch file (.bat and .cmd) can't seem to parse and loop a CSV file easily.

Perl? (interpolate the command line string with parameters and use backtick operator? )

`process_data.exe -name $name -value $value -o $outfile`
PowerShell?

Start-Process '$EXE -name "$name" -value "$VALUE" -o "$OUTFILE"'
Python?
os.system('process_data.exe -name "' + name + '" -value ' + value + ' -o "' + outfile + '"')
Not on Linux, so discounting Bash scripting.
u0206397 is offline   Reply With Quote