I am in an IT lock-down situation so I have limited access to things. I am trying to run the latest version of Portable Google Chrome 6. It won't let me install extensions and I think it's because I can't access my TEMP and TMP files, and for other reasons as well, I want to be able to change the temp variables with my daily run batch file. My code works fine but works only when my CMD window is open:

:T
CALL :TEMP
GOTO CHOICE

:TEMP
ECHO.Remaping TMP Drive
IF NOT EXIST %HOMEDRIVE%\jnk MD %HOMEDRIVE%\jnk
SET TMP=%HOMEDRIVE%\jnk
SET TEMP=%HOMEDRIVE%\jnk
ECHO.TEMP=%TEMP% and TMP=%TMP%
ECHO.Done.
ECHO.
PAUSE
GOTO :EOF

So I am reading these tips and I just can't get it. How can I check where System variable are stored for my Current User (HKCU)

link|improve this question
feedback

3 Answers

up vote 1 down vote accepted

HKCU\Environment\

reg add HKCU\Environment /v TEMP /t REG_SZ /d "%%HOMEDRIVE%%%%HOMEPATH%%\Temporary"
link|improve this answer
This looks like what I was about to try can add rewrite a value that already exists? – lazfish Sep 22 '10 at 14:42
1  
@lazfish: yes, add /f – grawity Sep 22 '10 at 14:54
OK Looks like it works but when I ECHO.%TMP% and %TEMP% I still get the default. So I go to change it with: reg add "hklm\system\CurrentControlSet\Control\Session Manager\Environment" /v TEMP /t REG_SZ /d "%%HOMEDRIVE%%%%HOMEPATH%%\jnk" /f reg add "hklm\system\CurrentControlSet\Control\Session Manager\Environment" /v TMP /t REG_SZ /d "%%HOMEDRIVE%%%%HOMEPATH%%\jnk" /f Instead and I get Access is denied. – lazfish Sep 22 '10 at 15:13
2  
The reg add call won't modify the env var values in your current shell, just values for new shells. You'll still need the set TEMP=... calls to see the changes in your current shell. – Ian C. Sep 22 '10 at 15:19
I noticed that. It it looks like the TEMP & TMP paths are using the Machine location instead of local user because even new shells show default for ECHO.%TMP% IT has got me. What can I say? – lazfish Sep 22 '10 at 15:42
show 3 more comments
feedback

The easiest way to make permanent changes to environment variables is: Control Panel > System > Advanced tab > Environment variables. The upper section contains variables for the current user.

link|improve this answer
Can't access, also I would have to do it everyday. – lazfish Sep 22 '10 at 14:24
feedback

I've used the SetEnv tool from BAT scripts to make permanent changes to environment variables. Works well. It's a shame it's not part of the Windows OS install. It's worked all the way to Vista for me. I haven't tried it in Windows 7.

link|improve this answer
SETX is standard on Vista/Win7 (and in the WinServer resource tools for earlier versions). – paradroid Sep 22 '10 at 16:30
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.