Batch file 如何以日期方式使用批处理脚本删除文件(用户输入为日期)

Batch file 如何以日期方式使用批处理脚本删除文件(用户输入为日期),batch-file,Batch File,这是我使用的脚本,但由于我是批处理脚本的新手我无法从用户处获取日期,应删除该日期下的文件 从我的备份脚本中提取: set backupdir=“%cd%” 设置删除旧的日期=14天后 对于文件-p%backupdir%-s-m*.zip/D-%n天之后删除旧文件%/C“cmd/C del@path” @echo off ::setting the local extensions setlocal enableextensions setlocal enabledelayedexpansi

这是我使用的脚本,但由于我是批处理脚本的新手
我无法从用户处获取日期,应删除该日期下的文件

从我的备份脚本中提取:

set backupdir=“%cd%”

设置删除旧的日期=14天后

对于文件-p%backupdir%-s-m*.zip/D-%n天之后删除旧文件%/C“cmd/C del@path”

@echo off


::setting the local extensions

setlocal enableextensions
setlocal enabledelayedexpansion

::setting the path and date 
:: %~dp0 this cmd fetch the path from where the script is running.(removed)


set /p path=Enter the path where the script has to be Run:
cd %path%
echo.%path%
echo. %date% %time% >>deletionlog.log

del *.* /s /q >null >>deletionlog.log

pause...