Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off & set "root=HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Regedit"
- call reg delete "%root:\\=\%" /v LastKey /f >nul
- mshta "javascript:window.close(new ActiveXObject('WScript.Shell').RegWrite("%root%\\LastKey",window.clipboardData.getData("Text")||'',"REG_SZ"))" >nul
- call :reg_query "%root:\\=\%" LastKey lastkey
- if defined lastkey set lastkey=%lastkey:"=%
- if defined lastkey set "lastkey=%lastkey:[=%"
- if defined lastkey set "lastkey=%lastkey:]=%"
- if defined lastkey reg add "%root:\\=\%" /v LastKey /d "%lastkey%" /f >nul
- start "w" mshta "javascript:window.close(new ActiveXObject('WScript.Shell').Run('regedit.exe -m', 1, 'False'))"
- exit/b
- echo off | clip & rem clear clipboard
- :reg_query %1:KeyName %2:ValueName %3:OutputVariable %4:other_options[example: "/t REG_DWORD"]
- setlocal & for /f "skip=2 delims=" %%s in ('reg query "%~1" /v "%~2" /z 2^>nul') do set "rq=%%s" & call set "rv=%%rq:*) =%%"
- endlocal & set "%~3=%rv%" & exit/b &rem AveYo - Usage:" call :reg_query "HKCU\MyKey" "MyValue" MyVar "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement