Answer the question
In order to leave comments, you need to log in
Need to extract files from .zip archives?
There are several archives with such names (name1.zip, name2.zip, name3.zip, and so on, the name is not necessarily name)
You need to extract a file from each zip archive (there is always one file in each such archive) and place it in an archive with the same name, but a different extension (from .zip to .rar, for example)
I managed to do this with two archives, and manually entering the file name, but how to do it in batches, that is, so that from each zip file, the file is archived into the archive with a different extension but the same name
I need it very urgently, thanks
Here is the code that I got
@echo off
set /p input="[.zip] Введите название файла без расширения: "
if not exist = "%cd%\%input%.zip" goto STOP
echo Извлечение архива "%input%.zip" в папку "temp\"....
"%ProgramFiles%\WinRAR\winrar.exe" x -y "%cd%\%input%.zip" "%cd%\temp\"
echo Извлечено!
echo Архивация файла из "temp" в архив "%input%.zpprofile"
if not exist = "%cd%\%input%.zip" goto STOP1
"%ProgramFiles%\WinRAR\winrar.exe" A -y -df -ep "%cd%\%input%.zpprofile" "%cd%\temp"
echo Архивация с заменой прошла успешно! Нажмите любую клавишу...
pause > null
exit
:STOP
echo "Файл %cd%\%input%.zip не найден!"
pause > null
:STOP1
echo "Файл %input%.zpprofile не найден!"
pause > null
Answer the question
In order to leave comments, you need to log in
Something like this.
:: Каталог с входными архивами
set "indir=c:\temp"
:: Каталог куда складывать выходные архивы, можно указать тот же, что и в indir
set "outdir=c:\temp\out"
:: Каталог для временных распакованных файлов
set "unarhdir=c:\temp\unarh"
:: Полный путь для запуска архиватора
set "arh=%ProgramFiles%\WinRAR\winrar.exe"
for %%a in ("%indir%\*.zip") do (
"%arh%" x -y "%%a" "%unarhdir%"
"%arh%" a -y -df "%%~dpna" "%unarhdir%\*"
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question