请高手看看,以下红色处执行不成功:
@echo off&&setlocal EnableDelayedExpansion
set /p N="请输入删除文件名的年份,按回车!【2015】:"
cd /d d:\电子报表\
mkdir tmp
for /f %%i in ('dir /a:-d /b') do (
set filename=%%i
set year=!filename:~0,4!
if "!year!" leq "n" move %%i tmp/>nul 2>&1
)
cd tmp
del /q *
cd ..
rmdir tmp
cd /d d:\电子报表\特殊退票\
mkdir tmp
for /f %%i in ('dir /a:-d /b') do (
set filename=%%i
set year=!filename:~8,4!
if "!year!" leq "n" move %%i tmp/>nul 2>&1
)
cd tmp
del /q *
cd ..
rmdir tmp
cd /d d:\电子报表\电子支付售票数据核对\
mkdir tmp
for /f %%i in ('dir /a:-d /b') do (
set filename=%%i
set year=!filename:~17,4!
if "!year!" leq "n" move %%i tmp/>nul 2>&1
)
cd tmp
del /q *
cd ..
rmdir tmp
exit