Hello there!
Nice forum!
Can anyone tell me what is wrong with my batch-script?
I am trying to iterate through a directory renaming all files in it. Hopefully it will append time/date to all the files in that directory.
I am not sure I want to have a new fileending (.kvi), so if someone can guide me into what is wrong, and how I can avoid giving it a new file ending would be nice.
FOR %%T in (%tmpDir%*.*) DO RENAME "%%T"
"%%~nT_%date:~10,4%_%date:~4,2%_%date:~7,2%_%.kvi"
What is wrong with this batch? renaming files in directory
Moderator: DosItHelp
-
- Posts: 79
- Joined: 13 Dec 2010 10:32
Re: What is wrong with this batch? renaming files in directo
Is that actually on 2 lines? or did it just split like that on the page? The one liner should work as long as %tmpDir% has a ending "\" (that is set tmpDir=C:\temp\)
Code: Select all
set tmpDir=C:\temp\
FOR %%T in (%tmpDir%*.*) DO rename "%%T" "%~nT_%date:~10,4%_%date:~4,2%_%date:~7,2%_.kvi"