6 replies
by joseph moore
You could use the variables %1 and %2 for command-line inputs. For example, setup a BAT file (TEST.BAT)with the following:
echo file name 1: %1
echo file name 2: %2
pause
dir %1
pause
echo hi again %2
At the command line type TEST.BAT FILE1.TXT FILE2.TXT
And here is the output:
file name 1: FILE1.TXT
file name 2: FILE2.TXT
Press any key to continue . . .
Volume in drive C has no label.
Volume Serial Number is 1489-87EB
Directory of C:\TEMP
04/05/00 05:01a 110,000 FILE1.TXT
1 File(s) 110,000 bytes
2,753,249,280 bytes free
Press any key to continue . . .
hi again basic.pdf
So, I did a directory listing with one of the file names from the %1 variable, and just displayed the 2nd file name from the other variable. I used the PAUSE just to break things up, to be easier to read.
Whatever goes in those variables is free game, just like any data in a variable. Do with it what you wish.
Hope this helps.
by joseph moore
by nt
by nt
This discussion is closed to new replies.
Trending Windows Forum posts
Sort by Trending