中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-07 23:33
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [原创]让“堪称压缩比世界第一的UHARC”自动化! 查看 1,235 回复 5
楼 主 [原创]让“堪称压缩比世界第一的UHARC”自动化! 发表于 2008-04-05 19:47 ·  中国 上海 杨浦区 电信
初级用户
★★
积分 153
发帖 68
注册 2006-10-12 22:25
19年会员
UID 65507
来自 上海
状态 离线
试下UHARC,支持右键发送到,自动识别文件数量、类型及是否文件夹、是否根目录,压缩文件名生成规则同WINRAR,直接生成自解压文件,压缩比堪称世界第一!
下面是我写的代码,供交流,有问题请大家完善。

@echo off
set file=%temp%\list.lst
del /q/f %file% >nul
set dp=%~dp1
set dd=%dp:~0,1%
set name=%~n1

:loop
if "%~1"=="" goto go
if "%~x1"=="" echo "%~1\*">>%file%&goto lop
echo "%~1">>%file%
:lop
shift
goto loop

:go
for /f "delims=: tokens=1" %%a in ('findstr /N ".*" %file%' do set Num=%%a
if %Num% EQU 1 goto Fil

set ddp=%dp:~,-1%
for /f "skip=1 delims=:" %%i in ('^(echo "%ddp%"^&echo.^)^|findstr /o ".*"' do set/a l=%%i-5
if %l% LEQ 3 goto Drv

for /f "delims=" %%i in ("%ddp%" do set tag=%%~nxi

uharc.exe a -sfx -mx "%dp%%tag%.com" @%file%
goto :eof

rv
uharc.exe a -sfx -mx "%dp%%dd%.com" @%file%
goto :eof

:Fil
uharc.exe a -sfx -mx "%dp%%name%.com" @%file%
个人主页-找餐厅:http://www.canting.cc
2 发表于 2008-04-05 20:22 ·  中国 北京 海淀区 联通
银牌会员
★★★
积分 1,287
发帖 634
注册 2007-05-02 15:06
19年会员
UID 87277
性别 男
来自 cmd.exe
状态 离线
这个不是UHARC把.
原版uharc根本没有-sfx开关...

UHARC 0.6a ----- high compression multimedia archiver ----- BETA version
Copyright (c) 1997-2005 by Uwe Herklotz All rights reserved 06 Feb 2005
**** Freeware for non-commercial use **** contact: uwe.herklotz@gmx.de ****

Usage: UHARC command archive
---< Commands >----------------------------------------------------------------
a create archive and Add files e Extract files to current directory
m create archive and Move files x eXtract files with full pathname
l List files in archive t Test files in archive
---< Switches >----------------------------------------------------------------
d<0..2> Set display mode (0 = quiet, 1 = default, 2 = verbose)
m<0..3,x,z> Set cmp.mode (0 = STORE, 1..3 = ALZ:fast..best, x = PPM, z = LZP)
md<n> Set dictionary size in KByte (must be power of 2 : 1 .. 32768)
mm Disable/enable built-in multimedia detection/compression
o Overwrite existing files (- = never, + = always, p = prompt)
p<-,r,f,e> Store (- = no, r = relative, f = full, e = excluded) pathnames
ph Archive header encryption | ac Clear file archive attr
pw Set password | ae<attr> Set attr exclusion mask
r Recurse subdirectories | b<n> Set max filebuffer size
t<dir> Set extract target dir | bpb bpb instead of % ratio
vm Set virtual memory usage | ed Store empty directories
y Assume yes on all queries | lg<file> Log output to <file>
-------------------------------------------------------------------------------



不知道你用的什么版本.
3 发表于 2008-04-06 23:56 ·  中国 上海 电信
初级用户
★★
积分 153
发帖 68
注册 2006-10-12 22:25
19年会员
UID 65507
来自 上海
状态 离线
有的,我用的是uharc06a UHARCSFX.EXE 原版说明里就有啊:


-sfx Create self-extracting archive (Win32 version ONLY !).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
With this option UHARC will create a self-extracting archive
(SFX). A self-extracting archive is a Win32 executable with
appended UHARC archive. Running a SFX archive without any
options will extract ("x" command) the archive content to
current directory. The SFX program supports "x", "e" and "t"
commands for any UHARC archive (self-extracting and normal
ones) with same command-line options as UHARC program. Other
commands are not supported.

is an optional parameter specifying the stub program
used to create the SFX archive. By default stub UHARCSFX.EXE
is used which must be located in current directory or in the
directory where UHARC.EXE is running from.

The SFX option is applicable only if new archive is created.
The following DOS command can be used in order to transform
an existing UHARC archive into SFX:
COPY /B UHARCSFX.EXE+"archive.uha" "archive.exe"
个人主页-找餐厅:http://www.canting.cc
4 发表于 2008-04-07 19:10 ·  中国 北京 海淀区 联通
银牌会员
★★★
积分 1,287
发帖 634
注册 2007-05-02 15:06
19年会员
UID 87277
性别 男
来自 cmd.exe
状态 离线
C:\Documents and Settings\lenovo>"I:\UHARC GUI v3.06 Beta-3\System\UHARC_06.exe"
a -sfx -mx "asdasdasd.uha" I:\autoit3\*.*

UHARC 0.6a ----- high compression multimedia archiver ----- BETA version
Copyright (c) 1997-2005 by Uwe Herklotz All rights reserved 06 Feb 2005
**** Freeware for non-commercial use **** contact: uwe.herklotz@gmx.de ****

ERROR: Can't create archive file
Process aborted.

..................
5 发表于 2008-04-07 20:35 ·  中国 上海 电信
初级用户
★★
积分 153
发帖 68
注册 2006-10-12 22:25
19年会员
UID 65507
来自 上海
状态 离线
呵呵,如果你们的没有UHARCSFX.EXE的话,那就把它压缩成.uha吧...我也忘了我是在哪下的了。
个人主页-找餐厅:http://www.canting.cc
6 发表于 2008-04-08 19:03 ·  中国 北京 海淀区 联通
银牌会员
★★★
积分 1,287
发帖 634
注册 2007-05-02 15:06
19年会员
UID 87277
性别 男
来自 cmd.exe
状态 离线
.....................
目前用NSIS+UNARC..
论坛跳转: