I am new to windows bat script. I have situation where I have a files coming in folder
D:\Source
with files such as
code_gen_text_111.txt
code_gen_text_222.txt
The windows script should generate zip files with same name in the same folder and also delete the existing txt file.
Example, result should be
code_gen_text_111.zip
code_gen_text_222.zip in folder D:\Source.
Can someone help me in providing the entire script to achieve this?
Batch script to zip file
Moderator: DosItHelp
Re: Batch script to zip file
How do you want them zipped? Using which program?
Do you know the command line of the ZIP program?
Multi-posted: http://stackoverflow.com/questions/2165 ... bat-script
Do you know the command line of the ZIP program?
Multi-posted: http://stackoverflow.com/questions/2165 ... bat-script
Re: Batch script to zip file
rajesherg wrote:I am new to windows bat script. I have situation where I have a files coming in folder
D:\Source
with files such as
code_gen_text_111.txt
code_gen_text_222.txt
The windows script should generate zip files with same name in the same folder and also delete the existing txt file.
Example, result should be
code_gen_text_111.zip
code_gen_text_222.zip in folder D:\Source.
Can someone help me in providing the entire script to achieve this?
Code: Select all
::simple code by xhai
echo off
:Archieve
set archievePatch=txt1.txt
set archievePatch2=txt2.txt
7z.exe a txt1.zip "%archievePatch%"
7z.exe a txt2.zip "%archievePatch2%"
DEL /F /Q "txt1.txt"
DEL /F /Q "txt2.txt"
PATH D:\Source
pause
exit
You need to Install the latest 7zip. copy the files in the same folder and run the .bat program
7z.dll
7z.exe
7-zip.dll
or
change 7z.exe a txt1.zip "%archievePatch%" to C:\Users\xhai>7z.exe a txt1.zip "%archievePatch%"
other might revise or improve the code because i'm still noob in here..
people here are helping me so i'm doing the best i can to help other's