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 able to create the below script to complete my task. I have modified the original script as per my requirement & give credit to the creator of this script ( Anonymous ).
@echo offTitle autozip.batREM updated 30/07/2015REM created by: AnonymousREM modified by: Yashwant VishwakarmaREM This script compresses files in a folder Note: files with the same name REM but with different extensions will be in the same archive.path=%path%;"c:\program files\winrar"REM ****************** Folder to compress******************set dir=C:\testzipREM *******************************************************REM change to directorycd %dir%echo Folder to compress in *.RAR format:echo %dir%echo Compressing files started....REM Compress files in directory individually without subdirectoriesecho.FOR %%i IN (*.*) do (rar a "%%~ni" "%%i")goto eof
In the original batch file script, there were 7 options which required manual intervention to choose and perform tasks. However, I want to completely automate this task so I modified it and its working absolutely fine for me.
Conclusion:
This is what I did with a given script, so I wanted to share my learning and experience with you. I hope it will help someone also when this type of requirement will come.
Keep smiling, rising, shining & stay blessed. ****Kindly vote this if you liked this article by clicking on the 'Vote' button & leave your precious comment !!! *****
Comments (1)
Author
Commented:Have a great day ahead :)
Keep smiling n shining always :)
Stay blessed :)