我每天分别将这个批处理文件写入zip文件。 但是,我想为文件夹做这件事。 问题是,每天我都有一个不同的文件夹名称。喜欢: 20170530.daily 20170529.daily 并在......
我附上了我已写过的批次,你能看看这个吗?
`@echo off
:: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe"
"%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
:: BatchGotAdmin (Run as Admin code ends)
:: Your codes should start from the following line
@echo off
for %%A in ("E:\Logs\SmartLogger\*") do (if /I not "%%~xA" == ".zip" 7za.exe
a -tzip -mx5 -y -- "%%~dpnA.zip" "%%~A" >nul && del /Q /F "%%~A")`