if {%1}=={} goto readme
:: --------------------------------------------------------------------
:: 定位 rar.exe 目录位置,请确认已经安装了Winrar
:: --------------------------------------------------------------------
del %temp%\Auto_rar_readme.txt >nul
del %temp%\$cd$.txt >nul
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.rar\ShellNew" /v "FileName">%temp%\$cd$.txt
for /f "skip=4 tokens=3 delims= " %%i in (%temp%\$cd$.txt) do set rarpath=%%~dpi
del %temp%\$cd$.txt
if exist "%rarpath%rar.exe" goto rarfile
if exist "%ProgramFiles%\winrar\rar.exe" set rarpath=%ProgramFiles%\winrar\
if not exist "%ProgramFiles%\winrar\rar.exe" goto norar
:: --------------------------------------------------------------------
:: 开始使用 rar.exe 分卷压缩目标文件
:: --------------------------------------------------------------------
:rarfile
:: ----------------------------------------------------
:: 修正了文件名中包含“;” 出错的问题 wz
:: ----------------------------------------------------
FOR /F "delims=" %%i IN ('echo %*') DO set name=%%~ni
md %BBSpath%
md %BBSpath%\%name%
set ext=%~x1
:: -----------------------------------------------------------------
:: -m<n> 设置压缩模式:
:: -m0 存储;-m1 最快;-m2 较快; -m3 标准; -m4 较好; -m5 最好
:: ------------------------------------------------------------------
set level=5
if {%ext%}=={.7z} set level=0
if {%ext%}=={.7Z} set level=0
if {%ext%}=={.rar} set level=0
if {%ext%}=={.RAR} set level=0
if {%ext%}=={.jpg} set level=0
if {%ext%}=={.JPG} set level=0