使用 windows 批處理指令(BAT文件)進行壓縮文件(zip)解壓操作


以下指令包括文件刪除、復制、zip文件解壓操作。使用7z指令指令進行解壓操作前,需要確保 windows 的 path 系統環境變量中存在7z的安裝路徑。

7z的下載地址:https://www.7-zip.org/download.html

::替換文件需要添加 /y 參數才能直接替換.不然會出現提示是否替換.

::復制Axis2Implementation和WebServices編譯后的文件到tomcat的webapps\axis2\WEB-INF\services和modules目錄下
@echo off
echo "先刪除tomcat對應目錄下的三個舊文件:Rdu-v1_0.aar、Log4JInit.aar、durLicense.mar"
del /f /s /q C:\xxx\RDUService\webapps\axis2\WEB-INF\services\Rdu-v1_0-C.aar
del /f /s /q C:\xxx\RDUService\webapps\axis2\WEB-INF\services\Log4JInit-C.aar
del /f /s /q C:\xxx\RDUService\webapps\axis2\WEB-INF\modules\durLicense-C.mar
echo.
echo "復制 WebServices的Rdu-v1_0-C.aar到tomcat的webapps\axis2\WEB-INF\services 目錄下"
copy /y \\tsclient\C\Development\2015.09.16.2.0\WebServices\Source\Implementation\RDU-WS\deploy\Rdu-v1_0-C.aar C:\xxx\RDUService\webapps\axis2\WEB-INF\services\

echo "復制 Axis2Implementation的Log4JInit-C.aar到tomcat的webapps\axis2\WEB-INF\services 目錄下"
copy /y \\tsclient\C\Development\2015.09.16.2.0\Axis2Implementation\Source\Implementation\ServiceLib\deploy\Log4JInit-C.aar C:\xxx\RDUService\webapps\axis2\WEB-INF\services\

echo "復制 Axis2Implementation的durLicense-C.mar到tomcat的webapps\axis2\WEB-INF\modules 目錄下"
copy /y \\tsclient\C\Development\2015.09.16.2.0\Axis2Implementation\Source\Implementation\ServiceLib\deploy\durLicense-C.mar C:\xxx\RDUService\webapps\axis2\WEB-INF\modules\

echo.
::使用7z來進行解壓文件,執行該bat前需要確保path環境變量中存在7z安裝路徑
echo "解壓 Axis2Implementation的axis2-WEB-INF-overlay2.zip 文件到tomcat的webapps\axis2\WEB-INF 目錄下"
7za x -y -aoa \\tsclient\C\Development\2015.09.16.2.0\Axis2Implementation\Source\Implementation\ServiceLib\deploy\axis2-WEB-INF-overlay2.zip -o"C:\xxx\RDUService\webapps\axis2\WEB-INF"

echo "解壓 WebServices的axis2-WEB-INF-overlay1.zip 文件到tomcat的webapps\axis2\WEB-INF 目錄下"
7za x -y -aoa \\tsclient\C\Development\2015.09.16.2.0\WebServices\Source\Implementation\RDU-WS\deploy\axis2-WEB-INF-overlay1.zip -o"C:\xxx\RDUService\webapps\axis2\WEB-INF"

 

原文地址:

https://www.cnblogs.com/poterliu/p/11212820.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM