6

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\

?

5 Answers 5

2

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

6

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).

3
3

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.

3
  • 1
    Note that this depends on the language of the OS and thus is a very poor solution to the problem.
    – Joey
    Jun 17, 2010 at 8:04
  • This is version-specific, and would not function on Windows Vista or Windows 7. %LOCALAPPDATA% Should work for them, though. Jun 17, 2010 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, 2010 at 10:35
3

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.

1
  • Thanks, this works perfectly and should have been the accepted answer.
    – Tony
    Apr 4, 2016 at 21:43
-3

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.

1
  • Its not clear for anyone how you want to help the others through your post.
    – avirk
    Nov 5, 2012 at 6:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .