Код:
@echo off
setlocal enableextensions enabledelayedexpansion
for /f "usebackq tokens=1,3" %%i in (
`2^>nul reg.exe query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" /v "UserOperations" /t REG_DWORD ^| find.exe /i "UserOperations"`
) do set /a i%%i = %%j
if defined iUserOperations (
if "%iUserOperations%" neq "1" call :AddParameterOrSetValue
) else (
call :AddParameterOrSetValue
)
endlocal
exit /b 0
:AddParameterOrSetValue
2>nul 1>&2 reg.exe add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" /v "UserOperations" /t REG_DWORD /d 0x01 /f
exit /b