Solved

batch to unzip file and extract jar

Posted on 2014-04-10
2
1,826 Views
Last Modified: 2014-04-10
folks

I have a file called "project.war"

I need a script to make a copy of this file

rename it to projectcopy.zip

extract a file called "test.jar"

and send to a folder on another server

how do I do that?
0
Comment
Question by:rutgermons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Expert Comment

by:OrcaKnight
ID: 39991827
If you just want a batch file, it's an easy one.
You'll need to install in your path a copy of pkunzip to do it.

@echo off
xcopy project.war projectcopy.zip
pkunzip projectcopy.zip test.jar
xcopy test.jar \\servername\sharename
echo Extraction complete!
0
 
LVL 54

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 39991843
Get yourself a copy of 7ZIP from this URL, and then adjust the paths in the BAT file below and it should do what you described.

http://www.7-zip.org/

@echo off

REM Adjust path to 7Zip program as needed below
set "zip=c:\program files\7-zip\7z.exe"

REM Set source and destination folder names
set BaseDir=c:\EE\EE28409614\base
set DestDir=x:\EE\EE28409614\dest

REM Make sure the needed file exists, exit if it does not
if not exist "%BaseDir%\project.war" exit /b

REM Copy the WAR file over as a ZIP and rename
copy "%BaseDir%\project.war" "%BaseDir%\projectcopy.zip"

REM Extract the TEST.JAR file to the destination folder
"%zip%" e "%BaseDir%\projectcopy.zip" -o"%DestDir%" test.jar

Open in new window

~bp
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question