make batch file that creates a folder with today's date then moves files from a folder in to that newly created folder

前端 未结 6 1021
抹茶落季
抹茶落季 2021-01-06 09:56

I need to make a batch file that will make a folder with today\'s date in month day year format (example 080112). Then once it\'s created i need to move files from a set fol

6条回答
  •  没有蜡笔的小新
    2021-01-06 10:19

    @echo on

    :: Use date /t and time /t from the command line to get the format of your date and :: time; change the substring below as needed.

    :: This will create a timestamp like yyyy-mm-dd-hh-mm-ss. set TIMESTAMP=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%-%TIME:~0,2%-%TIME:~3,2%-%TIME:~6,2%

    @echo TIMESTAMP=%TIMESTAMP%

    :: Create a new directory :: md e:\example\"%1\%TIMESTAMP%" xcopy /y c:\windows E:\windows\%TIMESTAMP% /e

    @echo on

提交回复
热议问题