我在 .bas 中写了一个脚本,但是我得到了一个错误“Unexpected occurrence: ).”。可以在代码中修复或删除哪些内容以使其正常运行?在这个版本中,我删除了 /r %ARCHIVE_DIR% %%F in (.rar,.zip) do (.
) 行中文件扩展名之间的空格@echo off
setlocal enabledelayedexpansion
set PASSWORD_FILE=passwords.txt
set EXCLUDE_FILES=*.exe *.bat *.scr *.lnk *.bin *.cmd *.js *.jse *.gadget *.jar *.msi *.wsf *.vbs *.ps1 *.app *.vb *.hta *.png *.jpg *.jpeg
set EXCLUDE_ITEMS="DomainDetects.txt" "ImportantAutofills.txt" "InstalledBrowsers.txt" "InstalledSoftware.txt" "DomainDetects.txt" "Information.txt" "Autofills.txt" "Bookmarks.txt" "Downloads.txt" "ProcessList.txt" "UserInformation.txt" "Screenshot.jpg"
set EXCLUDE_FOLDERS=Autofills Cookies FileGrabber
set RAR_PATH="C:\Program Files\WinRAR\WinRAR.exe"
set ARCHIVE_DIR="D:\cash\test"
set EXTRACT_DIR="D:\cash\output"
set TEMP_EXTRACT_DIR="D:\cash\temp"
for /r %ARCHIVE_DIR% %%F in (*.rar,*.zip) do (
echo Processing "%%~nxF"
set "OUTPUT_FOLDER=%EXTRACT_DIR%\%%~nF"
set "COUNTER=1"
:CHECK_FOLDER
if exist "!OUTPUT_FOLDER!" (
set /a COUNTER+=1
set "OUTPUT_FOLDER=%EXTRACT_DIR%\%%~nF (!COUNTER!)"
goto :CHECK_FOLDER
)
set PASSWORD=
for /f "usebackq delims=" %%P in ("%PASSWORD_FILE%") do (
set "PASSWORD=%%P"
if not exist "%TEMP_EXTRACT_DIR%" mkdir "%TEMP_EXTRACT_DIR%"
!RAR_PATH! x -p"!PASSWORD!" -y -ibck -ad -aoa -c- -ep1 -inul -m5 -o+ -ow -p- -x!EXCLUDE_FILES! -x!EXCLUDE_ITEMS! -x!EXCLUDE_FOLDERS! "%%F" "!TEMP_EXTRACT_DIR!"
if !errorlevel! equ 0 (
echo Extraction successful using password "%%P"
move /Y "!TEMP_EXTRACT_DIR!\*.*" "!OUTPUT_FOLDER!"
rd /s /q "!TEMP_EXTRACT_DIR!"
del "%%F"
goto :NEXT_ARCHIVE
)
rd /s /q "!TEMP_EXTRACT_DIR!"
)
echo Extraction failed for "%%~nxF" with all passwords
:NEXT_ARCHIVE
)
endlocal