Read and write REG_DWORD from batch file -
my requirement read reg_dword registry , write location. have succeeded in reading registry location, don't know how write.
my code:
@echo off reg query hkey_local_machine\software\microsoft\windows\currentversion\netcache /v "offlinedirrenamedelete" set previous=offlinedirrenamedelete reg add hkey_local_machine\software\microsoft\windows\currentversion\mysoftware /v "cachedelete" /t reg_dword /d previous /f
this code fails, "reg add" doesn't understand "previous" variable
i able hard-code value , set registry. example, works:
reg add hkey_local_machine\software\microsoft\windows\currentversion\mysoftware /v "cachedelete" /t reg_dword /d 5454 /f
but don't know how dynamic reg_dword value registry.
use %previous%
content of variable.
reg add hkey_local_machine\software\microsoft\windows\currentversion\mysoftware /v "cachedelete" /t reg_dword /d %previous% /f
here quick reference on using variables in batch files.
Comments
Post a Comment