batch file - Reg add for loop -


sorry if question has been asked before, haven't been able find answer can understand , apply.

i'm writing batch file installs application, , need batch file add registry key in software key every profile in hkey_users hive.

i've been able use reg add add key logged on user, because our desk running batch file elevated command prompt, change not affect user needs run application.

this had reg add

reg add "hkcu\software\application" /v "current practice" /t reg_sz /d "\\server\share"

any suggestions?

you need load user's hive registry before can modify it:

@echo off  setlocal  set "hive=hku\temp" set "key=software\application" set "value=current practice" set "data=\\server\share"  /d %%u in (c:\users\*) (   if exist "%%~u\ntuser.dat" (     reg load %hive% "%%~u\ntuser.dat"     reg add "%hive%\%key%" /v "%value%" /t reg_sz /d "%data%" /f     reg unload %hive%   ) ) 

Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -