Edit a registry entry & open the registry with a batch file

0

I am using a batch file to update the registry & would like to open the registry at HKLM\SYSTEM\CurrentControlSet\services\RasMan\PPP\EAP\13 to confirm the reg update was successful. The reg update executes but I can't get the registry to open at the specific path. The registry path can open before or after the update.


REM --add the following to the top of your bat file--

@echo off

:: BatchGotAdmin
:-------------------------------------
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------

echo off
start regedit
reg add HKLM\SYSTEM\CurrentControlSet\services\RasMan\PPP\EAP\13 /v TlsVersion /t REG_DWORD /d 0x000000c0

start regedit
HKLM\SYSTEM\CurrentControlSet\services\RasMan\PPP\EAP\13

end
batch-file
registry
asked on Stack Overflow Aug 24, 2016 by David_D • edited Aug 24, 2016 by David_D

1 Answer

0

If it is only about checking if the modification was sucessful, you could also read the value and print it on the screen:

REG EXPORT HKLM\SYSTEM\CurrentControlSet\services\RasMan\PPP\EAP\13 someFile.reg
TYPE someFile.reg
answered on Stack Overflow Aug 24, 2016 by Florian Straub

User contributions licensed under CC BY-SA 3.0