找到MakeCab - 一个文件夹中创建的所有文件CAB文件 [英] makecab - create a cab file from all the files in a folder

查看:605
本文介绍了找到MakeCab - 一个文件夹中创建的所有文件CAB文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个目录中的文件的一群。我试过下面找到MakeCab但它不是一个文件夹中的所有文件包括到cab文件。

I have bunch of files in a directory. I tried following makecab but it does not include all the files in a folder into the cab file.

makecab /d "C:\Users\crtorres\Documents\- SouthPacific Project 2014\- Projects\Sales Doc Center\New Region" test.cab

下面的作品,但cab文件只具有清单文件。
找到MakeCab的manifest.xml test.cab

The following works but the cab file only has the manifest file. makecab manifest.xml test.cab

推荐答案

我终于创建了一个脚本,可以真正做到这一点正确(使用PowerShell)

I've finally created a script that can actually do this properly (with powershell)

它不使用WSPBuilder因为我经常承包出去,它的不方便下载新的软件/额外的文件。这工作开箱即用的。

It doesn't use WSPBuilder as I'm often contracted out and it's inconvenient to download new software/extra files. This works OOTB.

function compress-directory([string]$dir, [string]$output)
{
    $ddf = ".OPTION EXPLICIT
.Set CabinetNameTemplate=$output
.Set DiskDirectory1=.
.Set CompressionType=MSZIP
.Set Cabinet=on
.Set Compress=on
.Set CabinetFileCountThreshold=0
.Set FolderFileCountThreshold=0
.Set FolderSizeThreshold=0
.Set MaxCabinetSize=0
.Set MaxDiskFileCount=0
.Set MaxDiskSize=0
"
    $dirfullname = (get-item $dir).fullname
    $ddfpath = ($env:TEMP+"\temp.ddf")
    $ddf += (ls -recurse $dir | ? {!$_.psiscontainer}|select -expand fullname|%{'"'+$_+'" "'+$_.SubString($dirfullname.length+1)+'"'}) -join "`r`n"
    $ddf
    $ddf | Out-File -encoding UTF8 $ddfpath
    makecab /F $ddfpath
    rm $ddfpath
    rm setup.inf
    rm setup.rpt
}

请让我知道,如果我做错事和/或可能会更好。

please let me know if i'm doing something wrong and/or could be better.

,以供参考:

<一个href=\"http://www.pseale.com/blog/StrongOpinionSayNoToMAKECABEXE.aspx\">http://www.pseale.com/blog/StrongOpinionSayNoToMAKECABEXE.aspx

这篇关于找到MakeCab - 一个文件夹中创建的所有文件CAB文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆