@ECHO OFF
SET hr=%time:~0,2%
IF %hr% lss 10 SET hr=0%hr:~1,1%
Set TODAY=%date:~4,2%-%date:~7,2%-%date:~10,4%-%hr%%time:~3,2%%time:~6,2%%time:~9,2%
ECHO.
ECHO.
这是从压缩
中排除“C:\ Users \ Downloads \ back \ temp”的文件夹 7za.exe a -tzip "C:\Users\Desktop\Downloadbak-%TODAY%.zip" "C:\Users\Downloads\back*" -mx5
ECHO.
PAUSE
答案 0 :(得分:2)
将当前文件夹更改为基本文件夹并使用-x
开关:
pushd C:\Users\Downloads\back
7za.exe a -tzip -mx5 -x!temp -x!exclude2 "C:\Users\Desktop\Downloadbak-%TODAY%.zip" *
popd
或管道dir
输出到find
以排除文件夹名称并将结果用作7zip的列表文件:
pushd C:\Users\Downloads\back
dir /b /a | findstr /i /v /r /c:"^temp$" >"%temp%\listfile"
7za.exe a -tzip -mx5 "C:\Users\Desktop\Downloadbak-%TODAY%.zip" @"%temp%\listfile"
del "%temp%\listfile"
popd