Solved

batch to unzip file and extract jar

Posted on 2014-04-10
2
1,787 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
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 53

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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

828 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