Saved Bookmarks
| 1. |
Solve : Bat file renaming? |
|
Answer» I am trying to find a way to change a single file NAME automaticlly daily with a batch file. I need the file name to include current date while keeping the extension. Can anyone help me with the SYNTAX for the bat file.For that case I think you need to have that file in a seperate folder then you can do this: For that case I think you need to have that file in a seperate folder then you can do this: In the command string the %TIME% is not a vaild syntax is there anything i can do with FOR command? The following CODE will put todays date in mmddyy format. Just use %currentDate% as the variable. (That is the variable that holds the date) So your code should look SOMETHING like this. SET dateMonth=%DATE:~4,2% SET dateDay=%DATE:~7,2% SET dateYear=%DATE:~12,2% SET currentDate=%dateMonth%%dateDay%%dateYear% ren "c:\folder\*.fileextension" "c:\folder\%currentDate%.fileextension" I didn't test this but i'm pretty sure it will work. |
|