How to create a folder with name as current date in batch (.bat) files

前端 未结 24 1314
被撕碎了的回忆
被撕碎了的回忆 2020-12-08 02:26

I don\'t know much about windows .bat file syntax. My simple requirement is to create a folder at a specific location with name as current date. I tried searching this on go

24条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 02:45

    for /F “tokens=1-4 delims=/ ” %%A in (‘date /t’) do (
        set DateDay=%%A
        set DateMonth=%%B
        set DateYear=%%C
    )
    set CurrentDate=%DateDay%-%DateMonth%-%DateYear%
    md %CurrentDate%
    

    This will give you a newly created folder with today’s date, in the format of DD-MM-YY

    Sourced from: Ali's Knowledge Base

提交回复
热议问题