RAR分割工具
set size=500k?? ;設(shè)置默認(rèn)大小
set BBSpath=D:\分割??????? ;設(shè)置默認(rèn)存放位置
if {%1}=={} goto readme
::????????????? 定位 rar.exe 目錄位置,請(qǐng)確認(rèn)已經(jīng)安裝了Winrar
del %temp%\RAR分割.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 分卷壓縮目標(biāo)文件
:rarfile
FOR /F "delims=" %%i IN ('echo %*') DO set name=%%~ni
md %BBSpath%
md %BBSpath%\%name%
set ext=%~x1
::???? -m<n>?? 設(shè)置壓縮模式:
::?? -m0 存儲(chǔ);-m1 最快;-m2 較快; -m3 標(biāo)準(zhǔn); -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
@echo ******************** %name% 分割紀(jì)錄 ******************** >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo. >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo 分割的原始文件路徑為:>>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo ├→ %1>>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo │ >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo 分割生成了以下文件,每個(gè)文件大小為 %size% :>>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
::???? 壓縮開始了!
"%rarpath%rar.exe" a -ep1 -m%level% -v%size% %BBSpath%\%name%\%name%.rar %1
@FOR /r %BBSpath%\%name% %%I in (*.rar) DO (
@echo ├─ %%I>>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
)
@echo │ >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo *******************%name% 記錄結(jié)束*********************** >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo. >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
start explorer %BBSpath%\%name%
set name=
goto end
::?????????? 系統(tǒng)中找不到 rar.exe 時(shí)候的錯(cuò)誤提示
:norar
del %temp%\RAR分割.txt >nul
@echo ================ 錯(cuò)誤提示:================>>%temp%\RAR分割.txt
@echo. >>%temp%\RAR分割.txt
@echo 在您的電腦中沒有找到 rar.exe 。>>%temp%\RAR分割.txt
@echo 請(qǐng)確認(rèn)您已經(jīng)安裝了 Winrar 。>>%temp%\RAR分割.txt
@echo 重新安裝 Winrar 可以修復(fù)這個(gè)問題。>>%temp%\RAR分割.txt
@echo. >>%temp%\RAR分割.txt
@echo ============== 錯(cuò)誤提示結(jié)束 ==============>>%temp%\RAR分割.txt
start notepad.exe %temp%\RAR分割.txt
goto end
::??????????????????? 沒有提交文件時(shí),彈出的使用說明
:readme
del %temp%\RAR分割.txt >nul
@echo. >>%temp%\RAR分割.txt
@echo ******************************使用注意******************************>>%temp%\RAR分割.txt
@echo. >>%temp%\RAR分割.txt
@echo 本工具是基于winrar的,請(qǐng)確保你已經(jīng)安裝了winrar,否則無法使用該工具。>>%temp%\RAR分割.txt
@echo ****************************** 使用方法 ***************************** >>%temp%\RAR分割.txt
@echo. >>%temp%\RAR分割.txt
@echo??? 把需要分割的單個(gè)文件或者單個(gè)文件夾,直接托拽到該工具上,可參考圖示>>%temp%\RAR分割.txt
@echo??? 分割工具會(huì)自動(dòng)調(diào)用 rar.exe, 將提交的文件或者目錄分割成指定大小>>%temp%\RAR分割.txt
@echo??? 的分卷rar壓縮文件,并保存在指定的目錄中。 >>%temp%\RAR分割.txt
@echo??? 對(duì)于提交的 7zip、rar、jpg 文件,分割工具只分卷打包,不做壓縮。 >>%temp%\RAR分割.txt
@echo. >>%temp%\RAR分割.txt
@echo ****************************** 友情提示 ***************************** >>%temp%\RAR分割.txt
@echo??? 默認(rèn)分卷大小為500k,分割后保存在D:\分割,并自動(dòng)打開該目錄!>>%temp%\RAR分割.txt
start notepad.exe %temp%\RAR分割.txt
goto end
:end
set size=
set BBSpath=
set name=
set rarpath=
set level=
set BBSpath=D:\分割??????? ;設(shè)置默認(rèn)存放位置
if {%1}=={} goto readme
::????????????? 定位 rar.exe 目錄位置,請(qǐng)確認(rèn)已經(jīng)安裝了Winrar
del %temp%\RAR分割.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 分卷壓縮目標(biāo)文件
:rarfile
FOR /F "delims=" %%i IN ('echo %*') DO set name=%%~ni
md %BBSpath%
md %BBSpath%\%name%
set ext=%~x1
::???? -m<n>?? 設(shè)置壓縮模式:
::?? -m0 存儲(chǔ);-m1 最快;-m2 較快; -m3 標(biāo)準(zhǔn); -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
@echo ******************** %name% 分割紀(jì)錄 ******************** >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo. >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo 分割的原始文件路徑為:>>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo ├→ %1>>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo │ >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo 分割生成了以下文件,每個(gè)文件大小為 %size% :>>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
::???? 壓縮開始了!
"%rarpath%rar.exe" a -ep1 -m%level% -v%size% %BBSpath%\%name%\%name%.rar %1
@FOR /r %BBSpath%\%name% %%I in (*.rar) DO (
@echo ├─ %%I>>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
)
@echo │ >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo *******************%name% 記錄結(jié)束*********************** >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
@echo. >>%BBSpath%\%name%\%name%_分割紀(jì)錄.txt
start explorer %BBSpath%\%name%
set name=
goto end
::?????????? 系統(tǒng)中找不到 rar.exe 時(shí)候的錯(cuò)誤提示
:norar
del %temp%\RAR分割.txt >nul
@echo ================ 錯(cuò)誤提示:================>>%temp%\RAR分割.txt
@echo. >>%temp%\RAR分割.txt
@echo 在您的電腦中沒有找到 rar.exe 。>>%temp%\RAR分割.txt
@echo 請(qǐng)確認(rèn)您已經(jīng)安裝了 Winrar 。>>%temp%\RAR分割.txt
@echo 重新安裝 Winrar 可以修復(fù)這個(gè)問題。>>%temp%\RAR分割.txt
@echo. >>%temp%\RAR分割.txt
@echo ============== 錯(cuò)誤提示結(jié)束 ==============>>%temp%\RAR分割.txt
start notepad.exe %temp%\RAR分割.txt
goto end
::??????????????????? 沒有提交文件時(shí),彈出的使用說明
:readme
del %temp%\RAR分割.txt >nul
@echo. >>%temp%\RAR分割.txt
@echo ******************************使用注意******************************>>%temp%\RAR分割.txt
@echo. >>%temp%\RAR分割.txt
@echo 本工具是基于winrar的,請(qǐng)確保你已經(jīng)安裝了winrar,否則無法使用該工具。>>%temp%\RAR分割.txt
@echo ****************************** 使用方法 ***************************** >>%temp%\RAR分割.txt
@echo. >>%temp%\RAR分割.txt
@echo??? 把需要分割的單個(gè)文件或者單個(gè)文件夾,直接托拽到該工具上,可參考圖示>>%temp%\RAR分割.txt
@echo??? 分割工具會(huì)自動(dòng)調(diào)用 rar.exe, 將提交的文件或者目錄分割成指定大小>>%temp%\RAR分割.txt
@echo??? 的分卷rar壓縮文件,并保存在指定的目錄中。 >>%temp%\RAR分割.txt
@echo??? 對(duì)于提交的 7zip、rar、jpg 文件,分割工具只分卷打包,不做壓縮。 >>%temp%\RAR分割.txt
@echo. >>%temp%\RAR分割.txt
@echo ****************************** 友情提示 ***************************** >>%temp%\RAR分割.txt
@echo??? 默認(rèn)分卷大小為500k,分割后保存在D:\分割,并自動(dòng)打開該目錄!>>%temp%\RAR分割.txt
start notepad.exe %temp%\RAR分割.txt
goto end
:end
set size=
set BBSpath=
set name=
set rarpath=
set level=
轉(zhuǎn)載于:https://blog.51cto.com/493517530/181634
總結(jié)
- 上一篇: 小米盒子/电视如何安装影视通APP?
- 下一篇: 联想K29笔记本主板图片