passing cmd line input parameters to GNU scripts run in Win7 batch files
A batch file has to first process and print out some data from the
datafile to let me select proper parameters %2 and %3 for later use. Next,
I have to enter manually those two select parameters.
What syntax should I use to request and input several parameters, possibly
using the SET /p command on a Win7 Pro box, when a batch file is being
run, so that these parameters are then passed on to various GNU utilities
which expect the %1 parameter format? Here's an example of a run.bat file
and its use:
C:\run <datafile>
@set /p pattern1=Enter pattern1:
@set /p pattern2=Enter pattern2:
@awk '/%1/,/%2/' datafile
This example should print all the lines between, and inclusive of, two
strings pattern1 and pattern2 from , but whatever parameter format I try
for pattern1 with the set /p command (%1, %%1, %1%,...), it doesn't work.
No comments:
Post a Comment