Windows – How to generically refer to the AppData folder on the Windows command line

command lineenvironment-variableswindowswindows 7

The original User's Profile directory lives in a directory like C:\Users\username\AppData.

How can I refer to the current user's profile directory when using the Windows command line?

By searching I found out about %UserProfile% that perhaps refer to the current username, but it does not really work. When I tried using it, I received the error "The filename, directory name, or volume label syntax is incorrect".

Best Answer

Run a command shell (start/Run, then "cmd") and type "set". This will list all the environmental variables available. Having said that, USERPROFILE is perfectly valid. There's also APPDATA and LOCALAPPDATA.

(Edit: stuartd has the right answer too - I was sidetracked while editing!)

Related Question