Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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)

share|improve this question

3 Answers 3

up vote 1 down vote accepted

HKCU\Environment\

reg add HKCU\Environment /v TEMP /t REG_SZ /d "%%HOMEDRIVE%%%%HOMEPATH%%\Temporary"
share|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

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.

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

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.

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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