I have a set of base filenames, for each name 'f' there are exactly two files, 'f.in' and 'f.out'. I want to write a batch file (in Windows XP) which goes through all the filenames, for each one it should:
- Display the base name 'f'
- Perform an action on 'f.in'
- Perform another action on 'f.out'
I don't have any way to list the set of base filenames, other than to search for *.in (or *.out) for example.
You can use this line to print the contents of your desktop:
Once you have the
%%I
variable it's easy to perform a command on it (just replace the word echo with your program)In addition, substitution of FOR variable references has been enhanced You can now use the following optional syntax:
In the above examples
%I
and PATH can be replaced by other valid values. The%~
syntax is terminated by a valid FOR variable name. Picking upper case variable names like%I
makes it more readable and avoids confusion with the modifiers, which are not case sensitive.You can get the full documentation by typing
FOR /?