Windows Mobile自動打包指令碼,支援中文捷徑

來源:互聯網
上載者:User

原理也就是利用setup.dll啊,我只是進行了一下命令列自動化,有時要打幾次包,麻煩得很。

使用方法:
1. 下載附件,解壓到任一目錄
2. 將你要放安裝的所有資源檔和exe放入此目錄,修改make.py,將Provider和AppName改為自己的,這裡不能出現中文AppName為目錄。
3. 如果要改程式捷徑名,改config/config.txt中chinaname即可。
4. 命令列運行make.py,可以看到編譯成功的資訊

指令碼代碼如下:

#coding=utf-8import osimport os.pathworkpath = os.path.dirname(__file__)Provider = "talkweb"  #公司名 不能為中文AppName  = "test"    #程式名 不能為中文SourceDisksNames = ""CopyFiles = ""SourceDisksFiles = ""DestinationDirs = ""Body = ""#cab工具目錄,mobile sdk5,6都行cab_tools = '"D:\Program Files\Microsoft Visual Studio 9.0\smartdevices\sdk\sdktools\cabwiz.exe"'f = open("template.inf")inf_content = f.read()f.close()nIndex = 1for root, dirs, files in os.walk(workpath):        for name in files:        if not name.endswith(".inf") and not name.endswith(".CAB") and not name.endswith(".py") :            #1=,"Common1",,"C:\workspace\WindowsMobile\InstallCab\"            SourceDisksNames += str(nIndex) + '=,\"Common'+str(nIndex)+'",,"'+root+'\\"'+"\n"            SourceDisksFiles += '"' + name + '"' + "=" + str(nIndex) + "\n"            #Files.Common1=0,"%InstallDir%\config"            DestinationDirs += "Files.Common"+str(nIndex)+'=0,"%InstallDir%'            if len(root[len(workpath):]) > 0 :                DestinationDirs += root[len(workpath):]            DestinationDirs += '"'+"\n"            #[Files.Common74]            #"SetupDLL.dll","SetupDLL.dll",,0            Body += "[Files.Common"+str(nIndex)+"]\n"            Body += ('"%s","%s",,0') % (name,name)            Body += "\n"            nIndex += 1for x in xrange(nIndex):    if x > 0:        CopyFiles += "Files.Common"+str(x)        if x != (nIndex-1):            CopyFiles += ","if __name__ == "__main__":    inf_content = inf_content.replace("{Provider}",Provider)    inf_content = inf_content.replace("{AppName}",AppName)    inf_content = inf_content.replace("{SourceDisksNames}",SourceDisksNames)    inf_content = inf_content.replace("{CopyFiles}",CopyFiles)    inf_content = inf_content.replace("{SourceDisksFiles}",SourceDisksFiles)    inf_content = inf_content.replace("{DestinationDirs}",DestinationDirs)    inf_content = inf_content.replace("{Body}",Body)    open(AppName+".inf","w").write(inf_content)    cmd = cab_tools + " "+AppName+".inf  /err CabWiz.log"    os.system(cmd)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.