1.

Solve : How to add file to zip /arj /rar with batch file??

Answer»

i want to ARCHIVE files with bat...

example
C:/helwy.txt make to C:/hellwy.zip(.rar/.arj) where in this archive is file hellwy.txt
please help me... Do you have a compression program such as WinZip or WinRar? WinZip (and probably WinRar) can be run from the command line with the proper switches, but many people use the program interface to compress/decompress files....it's easier and more intuitive.

Need more info on your setup. I have all programs... i know that work with program interfaces is much more easier.

I MUST create batch file for school with make folder in directory c: named by user, 3 txt files named by user and these text files i must compress in rar zip or arj by user choice...

Here is my homework

Title Lab. No_3
@Echo off
cls
echo --MAKE DIRECTORY--
echo.
echo.
echo.
echo To exit write "off".
set /p name= Enter the name of directory:
if "%name%"=="off" goto end
c:
cd\
mkdir %name%
echo.
echo.
echo "Directory %name% was CREATED!"
cd %name%
echo.
echo.
echo Push any button to continue!
pause>nul

cls
echo --Text file creating--
echo.
echo.
echo.
set/p text= Enter the name of *.txt file:
if "%text%"=="off" goto end
>> %text%_1.txt echo file1
>> %text%_2.txt echo file2
>> %text%_3.txt echo file3
echo.
echo.
echo "3 text files were created in directory %name%."
echo.
echo.
set/p cont= To Continiue-"1" Dir-"2"
if "%cont%"=="1" goto archive
if "%cont%"=="2" goto dir
pause>nul

:dir
cls
C:
cd\
cd %name%
echo.
echo.
echo.
dir
echo Push any button to continue!
pause>nul

:archive
cls
echo --Zip Arj Rar--
echo.
echo.
set /p arhiv= Choose - rar, zip arj:
if "%arhiv%"=="rar" goto rar
if "%arhiv%"=="zip" goto zip
if "%arhiv%"=="arj" goto arj
echo.

:rar
echo.
echo.
echo.
echo i don't undertstand how to make archive )
pause>nul
goto end

:zip
echo.
echo.
echo.
echo i don't undertstand how to make archive )
pause>nul
goto end

:arj
echo.
echo.
echo.
echo i don't undertstand how to make archive )
pause>nul
goto end

:end
cls
echo Push any button to continue!
pause>nul
echo (c) Hellwy 2005




PLEASE HELP! HI

EXCUSE for my poor english

Try this, i think it can work :
For Rar :
%ProgramFiles%\WinRAR\WinRAR.exe a -afrar Archive c:\UserDir\*.txt
For Zip :
%ProgramFiles%\WinRAR\WinRAR.exe a -afzip Archive c:\UserDir\*.txt


U need to adapt this to your known bat..

Hope this help...

@+Max



Discussion

No Comment Found