Link to home
Start Free TrialLog in
Avatar of Jim Metcalf
Jim MetcalfFlag for United States of America

asked on

Batch File to move and copy and compress a file

I just upgraded a pc to windows 10 pro.  The previous pc used a piece of software called pkzip.  my old batch file would call on pkzip.   Is there a way to do this with Windows 10 and the native compression utility.

This is the actual batch file code below that used pkzip.  If anyone could rewrite it with a native compression utility in Windows 10, that would be awesome.  If you can't rewrite it with windows 10.... can you point me to a utility that is free that can provide the same functionality.   This needs to be a very simple process for my user.
Avatar of NVIT
NVIT
Flag of United States of America image

Code?
Check out 7zip - it's free and they have a command line utility you can script (you didn't post any code or files).
Avatar of Bill Prew
Bill Prew

You didn't include a sample of the code.

My recommendation would be to ge the free utility 7-Zip and we can adjust the code to use it once we see your code.  Should be easy.  It's a well supported product and great for command line usage, Windows doesn't really have the same capability from a BAT script.

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

~bp
Avatar of Jim Metcalf

ASKER

sorry
cd mail
REM - This batch file compresses the files needed to send
REM - (notice)
c:\MAIL
@echo off
cd \mail
DEL abW.ZIP
CLS
PKZIP abW.ZIP DEL.FSW
ECHO ********************************************************************
ECHO Finished compressing the file - now it will be tested.
ECHO ********************************************************************
PKUNZIP -T abW.ZIP
ECHO ********************************************************************
ECHO ÿ
PAUSE
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
For native compression, i.e. without 3rd party tools like 7-zip or pkzip, you can use Powershell:

Compress-Archive -Path 'c:\MAIL\DEL.FSW' -DestinationPath 'c:\MAIL\abW.ZIP'

Open in new window

Sweet man it works!!!