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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -