Android 台灣中文網

打印 上一主題 下一主題

[分享] 7-Zip 教學 大家參考看看(有修改內容 紅色部份) -6

[複製連結] 查看: 73|回覆: 0|好評: 0
跳轉到指定樓層
樓主
old2009 | 收聽TA | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
發表於 2026-1-28 06:54

馬上加入Android 台灣中文網,立即免費下載應用遊戲。

您需要 登錄 才可以下載或查看,沒有帳號?註冊

x
Switches 用法:

                               
登錄/註冊後可看大圖




<Switches>
  -- : Stop switches and @listfile parsing
使用 -- 可以避免這種情況,確保後面的所有參數都作為文件名來處理,而不會被誤解為開關或選項。

總結:
•    -- 是一個 停止解析開關和 @listfile 的符號,它確保後續的所有參數都被當作純粹的文件名或路徑來處理。
•    它的主要用途是避免 7-Zip 將以 - 或 @ 開頭的文件名誤認為命令行選項或 listfile。
  





-ai[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : Include archives

基本結構:
•    -ai:這是選項的前綴,表示 "Include archives"(包含存檔)功能。也就是說,你可以指定 7-Zip 在進行壓縮或解壓時,是否要將某些存檔文件作為其他壓縮包的一部分來處理。
•    r[-|0]:這部分是 -r 選項的變化,-r 代表 遞歸處理(recurse),它會告訴 7-Zip 是否需要在子目錄中查找存檔文件。
o    r 允許遞歸。
o    r- 或 r0 禁止遞歸。這意味著如果目錄中有子目錄,這些子目錄中的文件將不會被包含在內。
•    m[-|2]:這是 -m 參數的變化,它控制 7-Zip 如何處理包含的存檔文件。
o    m 表示要使用某種壓縮方法來處理存檔。
o    m- 或 m0 禁用對存檔的壓縮方法。
o    m2 表示使用 LZMA2 壓縮方法來處理包含的存檔(如果你希望加強壓縮效果)。
•    w[-]:這是 -w 參數的變化,用來控制 工作目錄(working directory)。
o    w 表示將使用當前目錄作為工作目錄,並在該目錄中進行操作。
o    w- 禁用使用工作目錄。
•    {@listfile|!wildcard}:這部分指定要包括的存檔文件,可以使用兩種方式:
o    @listfile:這表示你可以將包含要處理的存檔文件的文件名列表放在一個文件中,這樣 7-Zip 就會按照這個文件中的內容來處理存檔。
    @listfile 是一個文本文件,每行包含一個存檔文件名或路徑,7-Zip 會按順序將這些存檔納入處理範圍。
o    !wildcard:這是使用通配符(wildcards)來指定文件名。這種方式允許你通過使用 * 和 ? 等符號,來匹配某些文件。例如,*.zip 會匹配所有 .zip 文件。
實際範例:
1.    遞歸地包括所有子目錄中的 .zip 文件,並使用 LZMA2 壓縮方法:
7z a output.7z -ai[r]m2w @filelist.txt

這條命令會將 filelist.txt 中列出的所有 .zip 存檔文件,包括其中的子目錄內的 .zip 文件(-r 表示遞歸),並且會使用 LZMA2 壓縮方法來處理這些存檔(m2)。

2. 只包括當前目錄中的 .zip 文件,不包括子目錄中的文件:
7z a output.7z -ai[r-]m0w !*.zip

這條命令會將當前目錄中的所有 .zip 文件加入到壓縮包中(!*.zip 用來匹配所有 .zip 文件),但是不會遞歸到子目錄(r-)。

3.從一個列表文件 archives.txt 中包含壓縮包,並禁用壓縮:
7z a output.7z -ai[r-]m0w @archives.txt

這條命令會從 archives.txt 文件中讀取壓縮包列表,並將這些壓縮包作為原始格式包括進來(m0 禁用壓縮)。


總結:
•    -ai 用來告訴 7-Zip 包括其他存檔文件(例如 .zip, .7z 等),並且可以控制如何處理這些存檔(是否遞歸、使用什麼壓縮方法等)。
•    可以使用 @listfile 來指定文件列表,也可以使用 !wildcard 來指定通配符匹配的文件。
•    這個選項在需要處理嵌套壓縮文件的情況下非常有用,例如將多個壓縮包包含到一個壓縮文件中。


在 7-Zip 命令中,m0w !*.zip 是一個特定的選項組合,讓我們來拆解並解釋每個部分的含義:
m0w:
•    m0:這是 -m 參數的設定,用來指定 壓縮方法。m0 表示 禁用壓縮,也就是說,所有被包含進壓縮包的文件不會被壓縮,而是以原始格式存儲(就像是簡單的文件拷貝)。
o    m 是設定壓縮方法的選項,而 0 表示 不進行壓縮。
•    w:這是 -w 參數,用來控制 工作目錄。w 表示將當前目錄設置為工作目錄。這意味著,7-Zip 在處理文件時,會使用當前目錄作為其操作的目錄。
o    使用 w 會讓 7-Zip 在當前工作目錄下操作,但通常也會被用來控制解壓縮過程中的文件讀取位置。
!*.zip:
•    !:這個符號用來指示 通配符 匹配文件。它告訴 7-Zip 使用 反向匹配(inverse match)。意思是它會選擇 不匹配 這個條件的文件。
o    所以,! 用來表示 排除。
•    *.zip:這是一個 通配符模式,表示所有擴展名為 .zip 的文件。這個模式將匹配當前目錄下所有的 .zip 文件。
組合在一起的含義:
•    m0w:禁用壓縮,並使用當前目錄作為工作目錄。
•    !*.zip:排除所有 .zip 文件。
整體解釋:
7z 命令中的 m0w !*.zip 意味著:
•    不對包含的文件進行壓縮(m0 表示不進行壓縮)。
•    在當前工作目錄下進行操作(w)。
•    排除所有 .zip 文件(!*.zip 表示排除所有擴展名為 .zip 的文件)。
實際用途:
這組選項的常見用途可能是:
1.    壓縮文件時,不壓縮 .zip 文件。假設你在處理一個包含 .zip 文件的資料夾,但你希望將其他文件壓縮進 .7z 文件,而不壓縮 .zip 文件,可以使用這個命令來排除 .zip 文件。

  -ax[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : eXclude archives






  -ao{a|s|t|u} : set Overwrite mode
  -an : disable archive_name field
  -bb[0-3] : set output log level
  -bd : disable progress indicator
  -bs{o|e|p}{0|1|2} : set output stream for output/error/progress line
  -bt : show execution time statistics
  -i[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : Include filenames
  -m{Parameters} : set compression Method
    -mmt[N] : set number of CPU threads
    -mx[N] : set compression level: -mx1 (fastest) ... -mx9 (ultra)
  -o{Directory} : set Output directory
  -p{Password} : set Password
  -r[-|0] : Recurse subdirectories for name search
  -sa{a|e|s} : set Archive name mode
  -scc{UTF-8|WIN|DOS} : set charset for console input/output
  -scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files
  -scrc[CRC32|CRC64|SHA256|SHA1|XXH64|*] : set hash function for x, e, h commands
  -sdel : delete files after compression
  -seml[.] : send archive by email
  -sfx[{name}] : Create SFX archive
  -si[{name}] : read data from stdin
  -slp : set Large Pages mode
  -slt : show technical information for l (List) command
  -snh : store hard links as links
  -snl : store symbolic links as links
  -sni : store NT security information
  -sns[-] : store NTFS alternate streams
  -so : write data to stdout
  -spd : disable wildcard matching for file names
  -spe : eliminate duplication of root folder for extract command
  -spf[2] : use fully qualified file paths
  -ssc[-] : set sensitive case mode
  -sse : stop archive creating, if it can't open some input file
  -ssp : do not change Last Access Time of source files while archiving
  -ssw : compress shared files
  -stl : set archive timestamp from the most recently modified file
  -stm{HexMask} : set CPU thread affinity mask (hexadecimal number)
  -stx{Type} : exclude archive type
  -t{Type} : Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options
  -v{Size}[b|k|m|g] : Create volumes
  -w[{path}] : assign Work directory. Empty path means a temporary directory
  -x[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : eXclude filenames
  -y : assume Yes on all queries




.....................................................................................................................

這邊要學習一下 很好用的

7-Zip 命令(指令)

因為實在功能太多了 就提供常用的幾個命令(指令)

首先 在搜尋列 輸入 cmd 以系統管理員身份執行

然後先將路徑指向 這裡





C:\Windows\system32>cd\

C:\>cd Program Files

C:\Program Files>cd 7-Zip

C:\Program Files\7-Zip >




在此路徑 輸入 7-Zip 命令(指令)

C:\Program Files\7-Zip >
C:\Program Files\7-Zip >底下有一個 7z.exe檔 就是用這個執行檔 下命令(指令)
C:\Program Files\7-Zip > 7z t e:\raw.7z   前面那個 紅色的 7z  執行檔 省略 .exe
你也可以輸入它 C:\Program Files\7-Zip > 7z.exe t e:\raw.7z



t     測試壓縮包的是否出錯

我有一佪 在 E槽 底下 raw.7z 壓縮檔
測試這個檔 是否能正常解壓

C:\Program Files\7-Zip>7z t e:\raw.7z

顯示如下: 表示正常

7-Zip 24.09 (x64) : Copyright (c) 1999-2024 Igor Pavlov : 2024-11-29

Scanning the drive for archives:
1 file, 23296248 bytes (23 MiB)

Testing archive: e:\raw.7z
--
Path = e:\raw.7z
Type = 7z
Physical Size = 23296248
Headers Size = 268
Method = LZMA2:24m
Solid = +
Blocks = 1

Everything is Ok

Folders: 2
Files: 3
Size:       23759577
Compressed: 23296248

a 壓縮

要壓縮 一個 E槽 底下 raw資料夾
C:\Program Files\7-Zip>7z a e:\raw  預設都是先壓縮.7z檔  副檔名.7z檔
C:\Program Files\7-Zip>7z a e:\raw\raw.zip 你可設定 副檔名.zip檔


這是結果

7-Zip 24.09 (x64) : Copyright (c) 1999-2024 Igor Pavlov : 2024-11-29

Scanning the drive:
1 folder, 108 files, 5864950 bytes (5728 KiB)

Creating archive: e:\raw.7z

Add new data to archive: 1 folder, 108 files, 5864950 bytes (5728 KiB)


Files read from disk: 107
Archive size: 1664881 bytes (1626 KiB)
Everything is Ok



要壓縮 一個 E槽 底下 ra raw ok 三個資料夾 壓縮檔 檔名取bc.7z 或bc.zip 將壓縮檔放在 e:\bc資料夾

C:\Program Files\7-Zip>7z a e:\bc\bc.7z  e:\ra e:\raw e:\ok

C:\Program Files\7-Zip>7z a e:\bc\bc.zip  e:\ra e:\raw e:\ok







指定密碼壓縮 -p 將 E槽 底下 raw資料夾 加密後 壓縮到 E槽  檔名是ok  副檔名是 .7z  預設`7-Zip 先壓縮成 .7z檔   你可以指定為 .zip

C:\Program Files\7-Zip>7z a e:\ok e:\raw -pcyn   密碼:cyn

C:\Program Files\7-Zip>7z a e:\ok.zip e:\raw -pcyn  密碼:cyn

C:\Program Files\7-Zip>7z a e:\ko\ko.7z e:\raw -pcyn 密碼:cyn



解壓帶密碼的壓縮檔

x表示 解壓檔到指定目錄。保持檔的原始路徑結構。注意不同之處#########

C:\Program Files\7-Zip>7z x -o"e:\bc" e:\ok.7z -pcyn   將有密碼(密碼為cyn) ok.7z檔 解壓到bc資料夾

注意這個要打檔案的副檔名喔!而且要指定解壓縮到哪個資料夾(不能與解壓縮檔的檔名相同)


e表示 解壓檔到目前的目錄或指定目錄,不保持原始目錄結構。注意不同之處#########


C:\Program Files\7-Zip>7z e -o"e:\bc" e:\ok.7z -pcyn 將有密碼(密碼為cyn) ok.7z檔 解壓到bc資料夾


C:\Program Files\7-Zip>7z i e:\ok.7z -pcyn   列出壓縮包內的檔內容及其他詳細資訊。


更新檔    u    更新已有壓縮包中的檔(只會添加或替換檔,不會刪除)。
刪除檔    d    從壓縮包中刪除指定的檔。



C:\Program Files\7-Zip>7z a -tzip e:\ok 將 E槽 ok資料夾 壓縮成 .zip檔

-t{format} -tzip   表示 壓縮成 .zip檔









分割壓縮檔 -v  將E槽的 Wonderful資料夾 底下的所有檔 分割壓縮為500M的分割檔
將它存到 E槽 的 ok資料夾  用7z壓縮格式  你也可以用zip

C:\Program Files\7-Zip>7z a e:\ok\Wonderful.7z e:\Wonderful\* -v500M

C:\Program Files\7-Zip>7z a e:\ok\Wonderful.zip e:\Wonderful\* -v500M


這是結果

7-Zip 24.09 (x64) : Copyright (c) 1999-2024 Igor Pavlov : 2024-11-29

Scanning the drive:
2 files, 3676154337 bytes (3506 MiB)

Creating archive: e:\ok\Wonderful.7z

Add new data to archive: 2 files, 3676154337 bytes (3506 MiB)


Files read from disk: 2
Archive size: 3675712271 bytes (3506 MiB)
Volumes: 8
Everything is Ok





7-Zip 合併壓縮檔

將 E槽 ok資料夾 底下的 所有分割檔 合併到 E槽 bm資料夾 檔名是 Wonderful.7z(取名與原檔名相同)

C:\Program Files\7-Zip>copy /b e:\ok\Wonderful.7z.* e:\bm\Wonderful.7z




查看e:\ok\底下的 Wonderful.7z檔  按右鍵--內容
會看見 壓縮 (001) 檔案 (.001)

只要用7-Zip 解壓縮第一個檔  (前面都巳提過 分割壓縮檔 只要解第一個檔即可(.001副檔名的)








解壓縮 分割壓縮檔 (把檔案解壓出來喔! 是這個意思啦!)

(前面都巳提過 分割壓縮檔 只要解第一個檔即可(.001副檔名的)

將E槽 ok資料夾底下的 Wonderful.7z.001分割檔 解壓縮到 E槽的 bm資料夾中


C:\Program Files\7-Zip>7z x -o"e:\bm" "e:\ok\Wonderful.7z.001"

C:\Program Files\7-Zip>7z x -oe:\bm e:\ok\Wonderful.7z.001


-o{path} -oe:\bm指定解壓後的輸出路徑。如果未指定,默認為目前的目錄。



C:\Program Files\7-Zip>7z -h  顯示命令列説明資訊。


7-Zip 24.09 (x64) : Copyright (c) 1999-2024 Igor Pavlov : 2024-11-29

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]

<Commands>
  a : Add files to archive  
  b : Benchmark
  d : Delete files from archive
  e : Extract files from archive (without using directory names)
  h : Calculate hash values for files
  i : Show information about supported formats
  l : List contents of archive
  rn : Rename files in archive
  t : Test integrity of archive
  u : Update files to archive
  x : eXtract files with full paths

<Switches>
  -- : Stop switches and @listfile parsing
  -ai[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : Include archives
  -ax[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : eXclude archives
  -ao{a|s|t|u} : set Overwrite mode
  -an : disable archive_name field
  -bb[0-3] : set output log level
  -bd : disable progress indicator
  -bs{o|e|p}{0|1|2} : set output stream for output/error/progress line
  -bt : show execution time statistics
  -i[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : Include filenames
  -m{Parameters} : set compression Method
    -mmt[N] : set number of CPU threads
    -mx[N] : set compression level: -mx1 (fastest) ... -mx9 (ultra)
  -o{Directory} : set Output directory
  -p{Password} : set Password
  -r[-|0] : Recurse subdirectories for name search
  -sa{a|e|s} : set Archive name mode
  -scc{UTF-8|WIN|DOS} : set charset for console input/output
  -scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files
  -scrc[CRC32|CRC64|SHA256|SHA1|XXH64|*] : set hash function for x, e, h commands
  -sdel : delete files after compression
  -seml[.] : send archive by email
  -sfx[{name}] : Create SFX archive
  -si[{name}] : read data from stdin
  -slp : set Large Pages mode
  -slt : show technical information for l (List) command
  -snh : store hard links as links
  -snl : store symbolic links as links
  -sni : store NT security information
  -sns[-] : store NTFS alternate streams
  -so : write data to stdout
  -spd : disable wildcard matching for file names
  -spe : eliminate duplication of root folder for extract command
  -spf[2] : use fully qualified file paths
  -ssc[-] : set sensitive case mode
  -sse : stop archive creating, if it can't open some input file
  -ssp : do not change Last Access Time of source files while archiving
  -ssw : compress shared files
  -stl : set archive timestamp from the most recently modified file
  -stm{HexMask} : set CPU thread affinity mask (hexadecimal number)
  -stx{Type} : exclude archive type
  -t{Type} : Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options
  -v{Size}[b|k|m|g] : Create volumes
  -w[{path}] : assign Work directory. Empty path means a temporary directory
  -x[r[-|0]][m[-|2]][w[-]]{@listfile|!wildcard} : eXclude filenames
  -y : assume Yes on all queries





7-Zip 提取檔案

將E槽 ok資料夾底下的 Wonderful.7z.001分割檔 提取檔案到 E槽的 ck資料夾


C:\Program Files\7-Zip>7z x e:\ok\Wonderful.7z.001 -oe:\ck    注意-oe 中間不能有空格

-o{path} -oe:\ck 指定解壓後的輸出路徑。如果未指定,默認為目前的目錄。


C:\Program Files\7-Zip>7z i    顯示 7z 工具的版本資訊。
結果
7-Zip 24.09 (x64)這是版本  : Copyright (c) 1999-2024 Igor Pavlov : 2024-11-29



創建一個自解壓壓縮包:
C:\Program Files\7-Zip>7z a -sfx e:\bc\hl.exe e:\mk

a 壓縮一個E槽 資料夾mk  用sfx 存到 E槽 bc資料夾 自解壓縮檔 檔名為hl.exe

-sfx  sfx模組   表示使用自解壓縮檔


創建加密的自解壓檔

C:\Program Files\7-Zip>7z a -sfx -pcyn e:\bc\hl.exe e:\mk   -p表示加密  密碼是cyn


在 7-Zip 中,Benchmark 是一個用來測量壓縮和解壓速度的命令。通過命令行,可以運行 7z 的 benchmark 模式,來測試不同算法在你系統上的性能


C:\Program Files\7-Zip>7z b

7-Zip 24.09 (x64) : Copyright (c) 1999-2024 Igor Pavlov : 2024-11-29

Compiler:  MSC 1400.140040310
Windows 10.0 19045
x64 6.4E03 threads:4 128TB f:1F110F2774C
Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
(406E3 : Intel64 Family 6 Model 78 Stepping 3) (C6->CC) 2400 MHz

1T CPU Freq (MHz):  2422  2242  2466  2470  2487  2442  2453
2T CPU Freq (MHz): 181% 2242   190% 2247
4T CPU Freq (MHz): 285% 1667   282% 1658

RAM size:   12180 MB,  # CPU hardware threads:   4
RAM usage:    889 MB,  # Benchmark threads:      4

                       Compressing  |                  Decompressing
Dict     Speed Usage    R/U Rating  |      Speed Usage    R/U Rating
         KiB/s     %   MIPS   MIPS  |      KiB/s     %   MIPS   MIPS

22:       6206   233   2594   6038  |      97570   279   2985   8324
23:       5725   227   2570   5833  |      82927   249   2878   7176
24:       4320   193   2411   4646  |      84477   258   2879   7413
25:       3983   183   2486   4548  |      86199   268   2864   7672
----------------------------------  | ------------------------------
Avr:      5058   209   2515   5266  |      87793   263   2901   7646
Tot:             236   2708   6456

C:\Program Files\7-Zip>

















還是註明出處: 阿榮福利味 (雖然阿榮說可以轉載)

7-ZIP SFX Maker 3.3 免安裝中文版 - 7z自解壓縮檔製作工具

https://www.azofreeware.com/2012/07/7-zip-sfx-maker-32-7z.html

免安裝版 不會在你的電腦留下登入檔的訊息   如果你不想再使用  刪除資料夾即可

不會有影響的 請放心下載 看清楚喔! 選免安裝版 解壓密碼是 azo

打開資料夾 執行 7-ZIP SFX Maker  語言選 繁體中文

如果要製作你專屬的 ico 有圖片的 自解壓縮檔

把你收藏的`ico檔 或網路下載的  把它存到 Resources 資料夾即可使用
選 圖示 那個功能 再選圖示








LZMA 軟體開發套件 亦可簡稱為 LZMA SDK

有興趣的網友 可以到官網下載相關檔案

官網可下載  
https://www.developershome.com/7-zip/sdk.asp


LZMA 軟體開發套件
C、C++、C#、Java
X86/x64 微軟視窗執行檔

結束了 希望大家學習一下。






「用Android 就來APK.TW」,快來加入粉絲吧!
Android 台灣中文網(APK.TW)
熱門小遊戲推薦

評分

參與人數 1幫助 +1 收起 理由
carl9313 + 1 偶像,看完你的內容,讓我找到了活著的意義.

查看全部評分

收藏收藏 分享分享 分享專題
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則