我正在尝试制作一个批处理文件来创建 12 个从 4 月开始到 3 月结束的文件夹。我不知道如何将输入的日期设置为 year1= 或如何将日期设置为 year2 1 年后。这是我到目前为止所拥有的。
@echo off
Rem( user input required say 2023 )
set /p input= Type The Year :
Rem ( 2023 from user input )
set Year1=
Rem ( 2023 from user input + 1 year )
set Year2=
MKDIR %year%
CD %year%
:: GOTO FULL_MONTH
:FULL_MONTH
mkdir "01 - April %Year1%"
mkdir "02 - May %Year1%"
mkdir "03 - June %Year1%"
mkdir "04 - July %Year1%"
mkdir "05 - August %Year1%"
mkdir "06 - September %Year1%"
mkdir "07 - October %Year1%"
mkdir "08 - November %Year1%"
mkdir "09 - December %Year1%"
mkdir "10 - January %Year2%
mkdir "11 - February %Year2%
mkdir "12 - March %Year2%
:DONE
Dir
Pause
您可以使用下面的 cmdlet 使用 Powershell 来完成此操作。
设置开始日期,然后在创建文件夹时使用计数器循环遍历月份。