Last active
February 26, 2016 07:52
-
-
Save wotupset/1b9c7ac7e405241162a1 to your computer and use it in GitHub Desktop.
7z批次壓縮.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
if {%1}=={} goto exit | |
set exe7z=C:\Program Files\7-Zip\7z.exe | |
:top | |
set vcoodate=%date:~2,2%%date:~5,2%%date:~8,2% | |
set vcootime=%time:~0,2% | |
if /i %vcootime% LSS 10 (set vcootime=0%time:~1,1%) | |
set vcootime=%vcootime%%time:~3,2%%time:~6,2% | |
set dir=%~d1%~p1 | |
set filename=%~n1%~x1 | |
set prm=a -t7z -mx=1 -ms=off -mtc=on -mf=off | |
cd /d "%dir%" | |
"%exe7z%" %prm% "%vcoodate%_%vcootime%.7z" "%filename%" | |
shift | |
if {%1}=={} goto end | |
goto top | |
:end | |
echo 轉換完成 | |
pause | |
:exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
rem 放在SendTo資料夾裡 | |
set path_7z=c:\program files\7-zip\7z.exe | |
set prm=a -t7z -m1 | |
for %%x in (%*) do ( | |
dir /a %%x|findstr "DIR" >nul 2>nul && ( | |
"%path_7z%" %prm% "%%~dpx%%~nx.7z" "%%~x\*" | |
) || ( | |
"%path_7z%" %prm% "%%~dpx%%~nx.7z" %%x | |
) | |
) | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment