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.

There's an environment variable, %appdata%, equal to

C:\Documents and Settings\<username>\Application Data\

Is there a variable for either

C:\Documents and Settings\<username>\Local Settings\

or

C:\Documents and Settings\<username>\Local Settings\Application Data\

?

share|improve this question

5 Answers 5

up vote 1 down vote accepted

For temporary changes you can use set command that can be used in scripts or in the command window.

More permanent changes can be made via the System properties dialog box by doing right-click on My Computer -> Properties and in the Advanced tab select Environment Variables. From there you can create new path variables to use.

There are also other ways to accomplish this task, see more info here

share|improve this answer

This is very cryptical, but it works with standard Windows XP commands:

for /f "tokens=4,5 delims=\" %a in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Local AppData"^|find "REG_SZ"') do set LocalAppData=%userprofile%\%a\%b

... and it is language independent (use %%a and %%b instead of %a and %b inside batch files).

share|improve this answer
1  
You did spot the glaring »Do not use this registry key« message in there? –  Joey Dec 23 '10 at 14:55
2  
Where should I have seen that? Who said "Do not use this registry key" ? –  Mehrdad Mirreza Dec 27 '10 at 14:32
    
@MehrdadMirreza: It is suggested to not access the registry for this, please see blogs.msdn.com/b/oldnewthing/archive/2003/11/03/55532.aspx for an explanation. - See as well: How can I get the path of a Windows “special folder” for a specific user? –  hakre Jan 26 '13 at 11:24

There isn't one by default, though you can type set into a command prompt to see a list of all environment variables on your system.

An alternative for you is to use %USERPROFILE%\Local Settings and %USERPROFILE%\Local Settings\Application Data or set your own environment variables with the set command.

share|improve this answer
1  
Note that this depends on the language of the OS and thus is a very poor solution to the problem. –  Joey Jun 17 '10 at 8:04
    
This is version-specific, and would not function on Windows Vista or Windows 7. %LOCALAPPDATA% Should work for them, though. –  Darth Android Jun 17 '10 at 8:05
    
Darth Android, the question specified Windows XP. As for a language independent way of getting the path, Johannes' solution is indeed superior –  James Jun 17 '10 at 10:35

There isn't such a variable on legacy Windows versions. However, you can get the folder path through VBScript:

Set objShell = CreateObject("Shell.Application")
WScript.Echo objShell.Namespace(&H1c&).Self.Path

You can then use this in a batch file as follows:

for /f "delims=" %%i in ('cscript /nologo localappdata.vbs') DO (
  set LOCALAPPDATA=%%i
)

On current versions of Windows this variable (%LOCALAPPDATA%) exists by default.

share|improve this answer

Just use %appdata% windows xp --

and use the explorer window up-arrow to nav to the users directory, then select local settings.

takes a split second or two. easy.

share|improve this answer
    
Its not clear for anyone how you want to help the others through your post. –  avirk Nov 5 '12 at 6:48

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.