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

前端 未结 24 1219
被撕碎了的回忆
被撕碎了的回忆 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条回答
  •  -上瘾入骨i
    2020-12-08 02:35

    I needed both the date and time and used:

    mkdir %date%-%time:~0,2%.%time:~3,2%.%time:~6,2%
    

    Which created a folder that looked like: 2018-10-23-17.18.34

    The time had to be concatenated because it contained : which is not allowed on Windows.

提交回复
热议问题