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

前端 未结 24 1305
被撕碎了的回忆
被撕碎了的回忆 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:49

    Quick and dirty: If you can live with the date being UTC instead of local, you can use:

    for /f "skip=1" %%d in ('wmic os get localdatetime') do if not defined mydate set mydate=%%d
    md %mydate:~0,8%
    

    Works in all locales. Only on XP and higher, though.

提交回复
热议问题