windows - extract zip files silently using batch file -
i have written below bat file extract zip files. not working when execute jenkins. suspect because since trying launch copy ui , service preventing doing windows services dont allow work uis. there way edit below script unzipping silently? if there other tools, please provide example.
@echo off /d %%p in ("%cd%\setups\*.*") rmdir "%%p" /s /q call mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -drepourl=http://10.101.15.190:8081/nexus/content/repositories/releases/ -dartifact=k:update-service:1.0.3 -ddest=setups/services/update-service.jar call mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -drepourl=http://10.101.15.190:8081/nexus/content/repositories/releases/ -dartifact=k:installer-prerequisites:1.0.0 -ddest=setups/prerequisites/installer-prerequisites.zip -dpackaging=zip call mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -drepourl=http://10.101.15.190:8081/nexus/content/repositories/releases/ -dartifact=k:-apps:1.0.0 -ddest=setups/apps/-apps.zip -dpackaging=zip call mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -drepourl=http://10.101.15.190:8081/nexus/content/repositories/releases/ -dartifact=k:mosquitto:1.0.0 -ddest=setups/mosquitto/mosquitto.zip -dpackaging=zip call mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -drepourl=http://10.101.15.190:8081/nexus/content/repositories/releases/ -dartifact=k:ble-service:1.0 -ddest=setups/services/ble-service.jar /r %%i in ("*.zip") ( call :unzipfile "%%~dpi" "%%~fi" del /s /q "%%~fi" ) exit \b :unzipfile <extractto> <newzipfile> setlocal set vbs="%temp%\_.vbs" if exist "%vbs%" del /f /q "%vbs%" >"%vbs%" echo set fso = createobject("scripting.filesystemobject") >>"%vbs%" echo if not fso.folderexists("%~1") >>"%vbs%" echo fso.createfolder("%~1") >>"%vbs%" echo end if >>"%vbs%" echo set objshell = createobject("shell.application") >>"%vbs%" echo set filesinzip=objshell.namespace("%~2").items >>"%vbs%" echo objshell.namespace("%~1").copyhere(filesinzip) >>"%vbs%" echo set fso = nothing >>"%vbs%" echo set objshell = nothing cscript //nologo "%vbs%" if exist "%vbs%" del /f /q "%vbs%" endlocal
you should use 7zip tool. after have installed it, should use following command.
"c:\program files\7-zip\7z.exe" e "c:\myzipfile.7z" -o"c:\extractedfolder" *.* -r -y
or parameterize batch file.
call "c:\scripts\mycustombatch.bat" "%workspace%\myzipfile.7z" "c:\extractedfolder"
mycustombatch.bat
cd "c:\program files\7-zip" 7z e %1 -o%2 *.* -r -y
7z.exe usage examples:http://www.dotnetperls.com/7-zip-examples
Comments
Post a Comment