Unrar a file in custom folder -


am trying extract rar file directory (c:\autoexe\source). here "autoexe" folder name changes everyday. fullname not change, constant thing "auto" in string "autoexe", exe part changes. tried below

for /f "delims=" %%a in ('dir /b "%cd%\samples\package.rar"') start "" "%programfiles%\winrar\winrar.exe" x -ibck "%cd%\samples\package.rar" *.* "%cd%\auto * \source" 

this commented batch code error handling should job:

@echo off rem name of first non hidden subfolder starting auto in current folder. /d %%i in (auto*) set "foldername=%%i" & goto checkarchive  echo error: there no auto* folder in: "%cd%" echo/ pause goto :eof  :checkarchive if exist "samples\package.rar" goto extractarchive  echo error: there no file "package.rar" in subfolder "samples" of echo        folder: "%cd%" echo/ pause goto :eof  :extractarchive "%programfiles%\winrar\unrar.exe" x -c- -idq -y -- "samples\package.rar" "%foldername%\" if not errorlevel 1 goto :eof  echo/ echo/ pause 

read text file rar.txt in program files folder of winrar details on used switches on unrar command line or run unrar.exe within command prompt window without option displayed brief on how use freeware console application.

for understanding used commands , how work, open command prompt window, execute there following commands, , read entirely pages displayed each command carefully.

  • echo /?
  • for /?
  • goto /?
  • if /?
  • pause /?
  • set /?

read answer on single line multiple commands using windows batch file explanation of & operator. , read microsoft support article testing specific error level in batch files.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -