还是纯批好- @echo off
- cd /d %~dp0
- title ExtractMSI v2 修订版
- set time=0
-
- :main
- mode con cols=31 lines=10
- if not "%~1"=="" set file=%~1&& goto special
- cls&set file=
- echo " _______ "
- echo " / MSI | "
- echo " |:::: | DRAG "
- echo " | :::: | HERE "
- echo " | :::: | "
- echo " |_______| "
- echo.
- echo 请拖入欲解压的MSI文件到此窗口
- echo 然后按“回车”(Enter)。
- set /p file=
-
- :checkfile
- if not exist "%file%" set error=file&&goto error
- call :get %file%
- if "%x%"==".msi" (goto extract) else (set error=msi)
- goto error
-
- :extract
- set select=
- cls
- mode con cols=60 lines=15
- echo.
- echo 本软件猜你要解压
- echo %nx%&echo.
- echo 到:
- echo %guess%&echo.
- echo 直接回车以采用以上路径&echo.
- set /p select=→
- if "%select%"=="" set target=%guess%&&goto confirm
-
- :guessagain
- cls&set select2=
- echo.&echo 我猜我猜我猜猜猜…… 你的意思是解压到……
- echo.&echo 1-%dp%%select%&echo.&echo 2-%d%\%select%
- echo.&echo .-返回 ..-重新选择文件&echo.
- set /p select2=选择→
- if "%select2%"=="1" set target=%dp%%select%&&goto confirm
- if "%select2%"=="2" set target=%d%\%select%&&goto confirm
- if "%select2%"=="." goto extract
- if "%select2%"==".." goto main
- goto guessagain
-
- :error
- cls
- echo 别玩了,这是什么玩意儿~
- echo.
- if "%error%"=="msi" echo 只可以拖入msi文件!
- if "%error%"=="file" echo 文件根本不存在!
- pause>nul
- goto main
-
- :get
- set d=%~d1
- set x=%~x1
- set n=%~n1
- set nx=%~nx1
- set dp=%~dp1
- set guess=%~dpn1
- exit /b
-
- :confirm
- cls
- echo.&echo 最后确认&echo.&echo 解压%nx%
- echo.&echo 到%target%
- echo.&echo ,- 确定 .- 返回&echo.
- set /p select=
- if "%select%"=="," goto process
- if "%select%"=="." goto extract
- goto confirm
-
- :process
- mode con cols=31 lines=10
- set file=%file:"=%
- cls
- echo.&echo 已调用msiexec.exe来解压,
- echo 如果看不见请等一会儿。&echo.
- msiexec.exe /a "%file%" /qb targetdir="%target%"
- if exist "%target%" (echo 应该可以了,按任意键去看看吧~) else (echo 你似乎取消了…… 任意键退出)
- pause>nul
- if exist "%target%" explorer "%target%"
- exit
-
- :special
- call :get "%file%"
- if "%x%"==".msi" (goto extract) else (set error=msi)
- goto error
复制代码
|