Note that the > character on the first
line redirects the output of the FC program to the output.txt file, which would
otherwise be displayed on the screen. The second line then opens the output.txt
file in Notepad for easy viewing.
There are ways, other than typing, to take advantage of command-line parameters.
If you place a shortcut to a batch file (say, Demo.bat) in your SendTo
folder, then right-click on a file in Explorer, select Send To and then Demo,
the Demo.bat batch file will be executed with the file you??™ve selected as the
first command-line parameter. Likewise, if you drag-drop any file onto the
batch-file icon in Explorer, the dropped file will be used as the commandline
parameter.*
Batch files have a limit of nine command-line parameters (%1 through %9),
although there??™s a way to have more if you need them. Say you need to
accept 12 parameters at the command line; your batch file should start by
acting on the first parameter. Then, you would issue the shift command,
which eliminates the first parameter, putting the second in its place. %2
becomes %1, %3 becomes %2, and so on. Just repeat the process until there are
no parameters left. Here??™s an example of this process:
:StartOfLoop
if "%1"=="" exit
del %1
shift
goto StartOfLoop
* If you drop more than one file on a batch-file icon, their order as arguments will be seemingly random,
theoretically mirroring their ordering in your hard disk??™s file table.
Pages:
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781