You could write something like the following:
set /a j=0
for /f %%a IN ('dir /b *.*') do (
set /a j=j+1
rename %%a !j!%%~xa
Edit: The %%~xa preserves the file extension. Note, if you don't MOVE the resulting file to somewhere else, such as don't use rename but instead
copy %%a <some directory>/!j!%%~xa
it'll try to catch the renamed files, too... So I'd use the copy and a temp dir, instead, perhaps creating the temp dir at the beginning of the batch file...
Last edited by hayabusa
on Wed Dec 28, 2011 2:48 pm, edited 1 time in total.
~ hayabusa ~
"All men can see these tactics whereby I conquer,
but what none can see is the strategy out of which victory is evolved."
- Sun Tzu, 'The Art of War'
OSCE, OSCP (Former - GPEN, C|EH - both expiring / expired)