extract.bat 724 B

1234567891011121314151617181920212223242526272829
  1. @echo off
  2. REM Check whether parameters are provided.
  3. if "%~1"=="" (
  4. echo err: Please specify the path of the compressed package to extract.
  5. exit /b 1
  6. )
  7. REM Get the compressed package path
  8. set "archive_path=%~1"
  9. REM Check whether the compressed package exists.
  10. if not exist "%archive_path%" (
  11. echo Error: The compressed package does not exist - %archive_path%
  12. exit /b 1
  13. )
  14. REM Extract to the current directory using tar.
  15. echo Decompressing:%archive_path%
  16. tar -xzvf "%archive_path%" -C .
  17. REM Check whether it is successful.
  18. if errorlevel 1 (
  19. echo Error: Decompression failed.
  20. exit /b 1
  21. ) else (
  22. echo Decompression succeeded! The content has been extracted to the current directory.
  23. )
  24. exit /b 0