我正在玩批处理文件和延迟扩展。
我只是试图打印目录中所有项目的文件/文件夹名称。
@ECHO off
SET title=%1
SET mp4="mp4"
SET mkv="mkv"
SET avi="avi"
SET minimumSize=300
CD "E:\Documents\Films\Need_compressing"
SETLOCAL ENABLEDELAYEDEXPANSION
FOR %%i IN (*) DO (
SET item = %%i
ECHO !item!
:: print dir/file name
:: if "!i!" == "%title%" (
:: echo "found file!"
:: 'if' directory
:: if exist "%title" (
:: echo "is a directory"
:: cd %title%
:: echo "title: " %title%
:: for %%f in (*.*) do (
:: set file = %%f
:: set extension = %%~xf
:: set fileSize = %%~zf
:: if %extension% == %mp4% if %extension% == %mkv% if %extension% == %avi% (
:: if %fileSize% gtr %minimumSize% (
:: move %file% %compressFolder%
:: )
:: )
:: )
:: )
::)
)
ENDLOCAL
当我这样做时,我会收到错误:
此命令的语法不正确
我唯一能想到的是我错误地使用了延迟扩展。