您的瀏覽器不支援JavaScript功能,若網頁功能無法正常使用時,請開啟瀏覽器JavaScript狀態
Antfire 的生活雜記
Skip
    banner

    7Z 指令的使用案例分享

    7Z 指令的使用案例分享

    7Z 指令列表

    命令

    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

    參數

    -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 : 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]]{@listfile|!wildcard} : eXclude filenames
    -y : assume Yes on all queries

    壓縮

    1. 無任何參數的話,就是將目前目錄整個打包起來
      "c:\Program Files\7-Zip\7z.exe" a "..\public.zip"
    2. 限制檔案類型
    "c:\Program Files\7-Zip\7z.exe" a "public.zip" -r "*.html"
    "c:\Program Files\7-Zip\7z.exe" a "public.zip" -r "*.html" "*.js*"

    解壓縮

    1. 無任何參數的話,就是壓縮檔解壓縮到目前的目錄下
      "c:\Program Files\7-Zip\7z.exe" x "public.zip"
    2. 解壓縮到指定目錄
      "c:\Program Files\7-Zip\7z.exe" x "public.zip" -o"public"

      -o後面沒有接空白喔

    3. 限制解壓縮的檔案類型
      一樣可以使用 -r參數
      "c:\Program Files\7-Zip\7z.exe" x "public.zip" -o"public" -r "*.js"
      想跳過覆蓋的提問訊息,可以加上-y
      "c:\Program Files\7-Zip\7z.exe" x "public.zip" -o"public" -r "*.js"  -y

    參考資料

     Comments