Change TEMP variables for all users

March 1, 2009 at 21:00:48
Specs: Windows XP
Hi.

I've been googling all day but i couldn't find a solution for what i need.

I want to create a .reg file to use (among other .reg files) after a fresh windows xp installation so all new created accounts point TEMP and TMP variables to C:\TEMP (%systemdrive%\TEMP).

I successfully changed System variables using this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
"TEMP"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,64,00,72,00,69,00,76,\
00,65,00,25,00,5c,00,54,00,45,00,4d,00,50,00,00,00
"TMP"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,64,00,72,00,69,00,76,00,\
65,00,25,00,5c,00,54,00,45,00,4d,00,50,00,00,00

But i can't change User variables. I tried changing [HKEY_USERS\.DEFAULT\Environment] but that didn't work.

I read somewhere that i would have to open regedit, load ntuser.dat from the default user, change the variables inside and save it, but i don't think i can do that from a .reg file or a batch file.

Any suggestions?

I only do what the voices in my head command...


See More: Change TEMP variables for all users

Report •


#1
March 1, 2009 at 21:16:01
This suggesion works, but it was to be manually done:

1) Modify Explorer settings to let you see hidden files
2) Go to Start-> Run -> type regedit
3) In the left pane of Registry Hightlight HKEY_USERS
4) Go to File -> Load Hive
5) Look in C:\Document and Settings\Default users and import ntuser.dat (name it Default user)
6) Look for key HKEY_USERS\Default user\Environment
7) modify TEMP and TMP to C:\TEMP
8) Unload Hive

This works exactly like i want it to. All newly created accounts after this use C:\TEMP in User Variables.

How do i make a batch file to automate this steps?

I only do what the voices in my head command...


Report •

#2
March 1, 2009 at 21:29:30
Undersand that by doing so you compromise the security on every system this is applied to. Now what used to be temp per profile is temp for all to see.

Report •

#3
March 1, 2009 at 21:35:37
Found it.

Batch file will need this:

reg load HKU\TempHive "C:\Documents and Settings\Default User\NTUSER.DAT"
regedit.exe /s temp_variables.reg
reg unload HKU\TempHive
md C:\TEMP

Reg file will be like this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
"TEMP"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,64,00,72,00,69,00,76,\
00,65,00,25,00,5c,00,54,00,45,00,4d,00,50,00,00,00
"TMP"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,64,00,72,00,69,00,76,00,\
65,00,25,00,5c,00,54,00,45,00,4d,00,50,00,00,00

[HKEY_CURRENT_USER\Environment]
"TEMP"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,64,00,72,00,69,00,76,\
00,65,00,25,00,5c,00,54,00,45,00,4d,00,50,00,00,00
"TMP"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,64,00,72,00,69,00,76,00,\
65,00,25,00,5c,00,54,00,45,00,4d,00,50,00,00,00

[HKEY_USERS\Temphive\Environment]
"TEMP"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,64,00,72,00,69,00,76,\
00,65,00,25,00,5c,00,54,00,45,00,4d,00,50,00,00,00
"TMP"=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,64,00,72,00,69,00,76,00,\
65,00,25,00,5c,00,54,00,45,00,4d,00,50,00,00,00

[HKEY_LOCAL_MACHINE\SYSTEM\...] changes System variables;
[HKEY_CURRENT_USER\Environment] changes current user variables;
[HKEY_USERS\Temphive\Environment] changes default profile user variables.

All i needed was to be half asleep to find the solution... :)

I only do what the voices in my head command...


Report •

Related Solutions

#4
March 2, 2009 at 08:09:30
And what was the problem you were trying to address?

Report •

#5
March 2, 2009 at 09:03:52
As i said in the first post, "I want to create a .reg file to use (among other .reg files) after a fresh windows xp installation so all new created accounts point TEMP and TMP variables to C:\TEMP (%systemdrive%\TEMP)".

Problem solved in Response Number 3, all i needed was to load Default User's HIVE and change TEMP variables in it, so future accounts use the new path.

I only do what the voices in my head command...


Report •


Ask Question