help on auto unziping file and saving to specific location

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
tweacle
Posts: 71
Joined: 11 Apr 2018 05:38

help on auto unziping file and saving to specific location

#1 Post by tweacle » 20 Apr 2018 14:06

Hi Ive decided to tackle my problem i have a different way.

I have files in a folder called C\Downloads and I have the following script of which creates a folder and asks me for a number of which I input and creates a folder.

Code: Select all

@echo off
setlocal enableExtensions enableDelayedExpansion
set "strDLFolder=C:\Downloads"
if not exist "%strDLFolder%" md "%strDLFolder%"

pushd "%strDLFolder%"
2>nul (>nul dir /b /A:-D *) || exit /b

:do
set "strNewFolder="
set /p "strNewFolder=Enter the name of the folder to be created: "
if not ^"!strNewFolder:"=!" == "!strNewFolder!" goto :do
md "%strNewFolder%" || goto :do

move "*" "%strNewFolder%"
"C:\Program Files\7zip\7z.exe" a "C:\COMPLETED\%strNewFolder%.zip" -P"zip" -m"em=ZipCrypto" "%strNewFolder%" -p
popd
goto :eof
What im trying to do is after file created I need to zip the file but NOT password protect . Once its been zipped can I move it to a new file C\DOWNLOADSZIPPED.
Last edited by Squashman on 20 Apr 2018 14:09, edited 1 time in total.
Reason: MOD EDIT: Probably the millionth time I have asked you to use CODE Tags.

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: help on auto unziping file and saving to specific location

#2 Post by penpen » 23 Apr 2018 05:07

COrrecting your typo, the command line you are searching for probably is:

Code: Select all

"C:\Program Files\7zip\7z.exe" a "C:\COMPLETED\%strNewFolder%.zip" -t"zip" "%strNewFolder%"
penpen

Post Reply