Renaming file by its name and date using batch fil

2019-08-20 17:31发布

I am trying to create a batch file that renames all the files in the folder by its name concatenate underscore and date.For example if there is a file name is >User1 so it will be >User1_25072012. I found a code which changes all the file name by date but not by the name and the date as in the example above.

So could you please show me a way?

Thanks in advance.

1条回答
该账号已被封号
2楼-- · 2019-08-20 17:46

This should do it

@echo off
cd "C:\account folder"
for /f "tokens=1-3 delims=/" %%a in ('echo %date%') do set today=%%a%%b%%c
for %%f in (*.*) do ren "%%f" "%%~nf_%today%%%~xf"
查看更多
登录 后发表回答