@echo off

pushd "%~dp0"
path %~dp0;%PATH%

rem rds backup untar
echo ==============================================
echo =                                            =
echo =        Aliyun RDS Backup UnTar             =
echo =                                            =
echo ==============================================

echo 请把 RDS 备份文件放到本目录 "%~dp0"
set /p DUMMY=按回车开始解压:

for %%I in ("*.tar", "*.tar.gz") do (
	(
		if not exist "%%~nI" ( md "%%~nI" )
	) && (
		cd "%%~nI"
	) && (
		tar.exe ixvf "../%%~nxI"
	) && (
		start .
		cd ..
	) && (
	  echo.
		echo 解压 "%%~nxI" 成功
		echo.
	) || (
	  echo.
		echo 解压 "%%~nxI" 失败
		echo.
	)
)

pause
