?
Solved

reg.exe ADD commands to REG_SZ Modifications not showing

Posted on 2014-08-20
8
Medium Priority
?
552 Views
Last Modified: 2014-08-22
Windows 7, testing batch file, works fine on other keys/values in the default user hive, but I don't think it's working properly for key values that are of the REG_SZ datatypes.

REG LOAD HKU\DefaultUser %SystemDrive%\Users\Default\NTUSER.DAT

%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v AutoEndTasks /t REG_SZ /d 1 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v HungAppTimeout /t REG_SZ /d 1000 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v MenuShowDelay /t REG_SZ /d 10 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v WaitToKillAppTimeout /t REG_SZ /d 20 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v LowLevelHooksTimeout /t REG_SZ /d 1000 /f

REG UNLOAD HKU\DefaultUser

Open in new window


So if I run the above, then go into the actual Registry GUI and load the same hive and go to Control Panel\Desktop for the default user's hive, the settings don't appear changed.
MenuShowDelay has a value of 0 for example, when it should have been set to 10 per the command.
But, if I run the reg QUERY command against the key, the values appear to be changed to 10, not 0.

Is it really changed in the Registry? Or do I have to reboot for the changes to show in the Registry's GUI?
0
Comment
Question by:garryshape
  • 3
  • 3
  • 2
8 Comments
 
LVL 25

Expert Comment

by:chaau
ID: 40275407
I don't think you need REG LOAD and REG UNLOAD.
Just add the entries directly into "HKU\.DEFAULT\Control Panel\Desktop"
0
 
LVL 14

Accepted Solution

by:
Rob Miners earned 1332 total points
ID: 40275512
What you are doing is modifing the Default User Profile and by adding those references when a new User Profile is created those references will be added to HKEY_CURRENT_USER\Control Panel\Desktop.

They won't show in the registry until you create a new user account and load their hive or run a reg query against the new user.

You can modify the Ntuser.dat hive so that all newly created users inherit certain settings. Anything that can be defined or modified in HKEY_CURRENT_USER can also be set in the Ntuser.dat hive (for example, international settings, colors, screen savers, sounds, and cursors).

The default user profile is created when Windows NT is installed. The first time a user logs on to a workstation (or domain), the default user profile is copied to the user profile.

Logon as the new user and run this commandline and you will see that your changes have been added to the new users profile.

reg query "HKCU\Control Panel\Desktop" /s > %temp%\deskPan.txt & notepad %temp%\deskPan.txt

ref#      http://support.microsoft.com/kb/146050
0
 

Author Comment

by:garryshape
ID: 40277967
I understand that but I'm saying the Default User registry isn't changing itself.
If I load the Default User hive in command, and update the key to value of 10, and unload it, then I go into Registry and import the same Default User hive, navigate to the key/value I just updated via command, I do not show the changes reflected.
I can see them reflected just fine on DWORD values though
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 25

Assisted Solution

by:chaau
chaau earned 668 total points
ID: 40277988
OK then, if you insist on loading the registry file, don't you need to REG SAVE it instead of unloading?
REG LOAD HKU\DefaultUser %SystemDrive%\Users\Default\NTUSER.DAT

%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v AutoEndTasks /t REG_SZ /d 1 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v HungAppTimeout /t REG_SZ /d 1000 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v MenuShowDelay /t REG_SZ /d 10 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v WaitToKillAppTimeout /t REG_SZ /d 20 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v LowLevelHooksTimeout /t REG_SZ /d 1000 /f

REG SAVE HKU\DefaultUser %SystemDrive%\Users\Default\NTUSER.DAT

Open in new window

0
 

Author Comment

by:garryshape
ID: 40278019
Reg Save, not that I'm aware of. Is that suppose to save settings to a file or commit the changes to an actual .dat to commit the registry changes?
I haven't had to use that for the dozens of other keys/values I've modified within the Default User hive and verified.
0
 
LVL 14

Assisted Solution

by:Rob Miners
Rob Miners earned 1332 total points
ID: 40278036
Add @echo on and pause to your batch file to see if there are any errors.

@echo on
REG LOAD HKU\DefaultUser %SystemDrive%\Users\Default\NTUSER.DAT

%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v AutoEndTasks /t REG_SZ /d 1 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v HungAppTimeout /t REG_SZ /d 1000 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v MenuShowDelay /t REG_SZ /d 10 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v WaitToKillAppTimeout /t REG_SZ /d 20 /f
%windir%\System32\reg.exe ADD "HKU\DefaultUser\Control Panel\Desktop" /v LowLevelHooksTimeout /t REG_SZ /d 1000 /f

REG UNLOAD HKU\DefaultUser

pause

It is working fine for me when I run the command as Administrator.

@echo off
REG LOAD HKU\DefaultUser %SystemDrive%\Users\Default\NTUSER.DAT

%windir%\System32\reg query "HKU\DefaultUser\Control Panel\Desktop" /v "AutoEndTasks" > %temp%\regQ.txt
%windir%\System32\reg query "HKU\DefaultUser\Control Panel\Desktop" /v "HungAppTimeout" >> %temp%\regQ.txt
%windir%\System32\reg query "HKU\DefaultUser\Control Panel\Desktop" /v "MenuShowDelay" >> %temp%\regQ.txt
%windir%\System32\reg query "HKU\DefaultUser\Control Panel\Desktop" /v "WaitToKillAppTimeout" >> %temp%\regQ.txt
%windir%\System32\reg query "HKU\DefaultUser\Control Panel\Desktop" /v "LowLevelHooksTimeout" >> %temp%\regQ.txt

REG UNLOAD HKU\DefaultUser

start notepad %temp%\regQ.txt
0
 

Author Closing Comment

by:garryshape
ID: 40280163
ok ty guys
0
 
LVL 14

Expert Comment

by:Rob Miners
ID: 40280166
Your welcome :)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month15 days, 23 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question