Reputation: 3
I'm compress single file update.ver to update.rar used rar.exe in command line ( batch files ) dictionary size 1024KB please help me to make this batch file
@echo off
REM Path to WinRAR executable in Program Files
set path="C:\Program Files\WinRAR\Rar.exe";%path%
echo 1. Compress files in dir individually (no subdirs)
echo.
echo.
set /P
if "%FILE%"=="1" goto indiv
REM Compress files in directory individually (no subdirectories)
:indiv
echo.
echo.
FOR %%i IN (*.*) do (
rar a "%%~ni" "%%i"
)
goto eof
:eof
endlocal
Erase v6.rar
Erase update.ver
rename update.rar update.ver
this code not work in windows vps
Upvotes: 0
Views: 3817
Reputation: 37569
Some example code:
@echo off &setlocal
REM Path to WinRAR executable in Program Files
set "path=C:\Program Files\WinRAR;%path%"
echo 1. Compress files in dir individually (no subdirs)
echo(
echo(
set /P "answer="
if not "%answer%"=="1" goto eof
REM Compress files in directory individually (no subdirectories)
:indiv
echo(
echo(
FOR %%i IN (*) do (
rar a "%%~ni.rar" "%%~i" || echo Error building archive!
)
Erase v6.rar
Erase update.ver
rename update.rar update.ver
Upvotes: 1