Major .bin and extraction code overhaul * All .cmd files now have code for searching the for the .bin folder * This starts at the script's parent folder and moves upward * If no .bin folder is found then print an error to the screen * 7z has been replaced with 7za * This is for better handling of x32/x64 usage * This also fixed a few bugs with extracting ProduKey/MailPassView/etc * We no longer require the full power of 7z.exe/7z.dll * (Since wimlib-imagex will probably be used for WIM files soon-ish) * Bugfixes * A few calls of pushd were unsafe (without quotes) * SFC scan no longer closes immediately
103 lines
2 KiB
Batchfile
103 lines
2 KiB
Batchfile
@echo off
|
|
|
|
:Flags
|
|
for %%f in (%*) do (
|
|
if /i "%%f" == "/DEBUG" (@echo on)
|
|
)
|
|
|
|
:FindBin
|
|
set bin=
|
|
pushd "%~dp0"
|
|
:FindBinInner
|
|
if exist ".bin" (
|
|
set "bin=%cd%\.bin"
|
|
goto FindBinDone
|
|
)
|
|
if "%~d0\" == "%cd%" (
|
|
goto FindBinDone
|
|
) else (
|
|
cd ..
|
|
)
|
|
goto FindBinInner
|
|
:FindBinDone
|
|
popd
|
|
if not defined bin goto ErrorNoBin
|
|
|
|
:Init
|
|
setlocal EnableDelayedExpansion
|
|
|
|
:ClearConfigs
|
|
if not exist "%bin%\tmp" goto FindHives
|
|
pushd "%bin%\tmp"
|
|
if exist "ProduKey.cfg" del "ProduKey.cfg"
|
|
if exist "ProduKey64.cfg" del "ProduKey64.cfg"
|
|
popd
|
|
|
|
:FindHives
|
|
set choices=L
|
|
echo.L: ~Local System~
|
|
set "_S=%systemdrive%\WK\Transfer\Software"
|
|
if exist "!_S!" (
|
|
set "choices=!choices!S"
|
|
echo.S: !_S!
|
|
)
|
|
set "_T=%systemdrive%\WK\Transfer\Windows\System32\config\Software"
|
|
if exist "!_T!" (
|
|
set "choices=!choices!T"
|
|
echo.T: !_T!
|
|
)
|
|
set "_O=%systemdrive%\WK\Transfer\Windows.old\Windows\System32\config\Software"
|
|
if exist "!_O!" (
|
|
set "choices=!choices!O"
|
|
echo.O: !_O!
|
|
)
|
|
set "_P=%systemdrive%\WK\Transfer\Windows.old\Software"
|
|
if exist "!_P!" (
|
|
set "choices=!choices!P"
|
|
echo.P: !_P!
|
|
)
|
|
|
|
:Choose
|
|
echo.
|
|
set "args="
|
|
|
|
rem If there are no choices, then don't ask
|
|
if "!choices!" == "L" (goto Extract)
|
|
|
|
rem pick souce and use response to set sw_hive
|
|
choice /c !choices! /t 10 /d l /m "Please select source"
|
|
set /a "index=!errorlevel! - 1"
|
|
set "choice=!choices:~%index%,1!"
|
|
|
|
rem Transferred hives
|
|
if "!choice!" == "S" (set "sw_hive=!_S!")
|
|
if "!choice!" == "T" (set "sw_hive=!_T!")
|
|
if "!choice!" == "O" (set "sw_hive=!_O!")
|
|
if "!choice!" == "P" (set "sw_hive=!_P!")
|
|
|
|
rem set args
|
|
if !index! neq 0 (set "args=/regfile !sw_hive!")
|
|
|
|
:Extract
|
|
cls
|
|
mkdir "%bin%\tmp" >nul 2>&1
|
|
call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "e ProduKey.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait
|
|
ping -n 1 127.0.0.1>nul
|
|
|
|
:Launch
|
|
call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "ProduKey.exe" "!args!" /admin
|
|
|
|
:Done
|
|
endlocal
|
|
goto Exit
|
|
|
|
:ErrorNoBin
|
|
color 4e
|
|
echo ".bin" folder not found, aborting script.
|
|
echo.
|
|
echo Press any key to exit...
|
|
pause>nul
|
|
color
|
|
goto Exit
|
|
|
|
:Exit
|