Putting %appdata% into the run window will open up the Appdata folder, but what is the command to open the User's Documents folder, even when someone else logs in? I thought it was something like %userdir%, but I can not find out what it is. Not sure what to search for in Google either so I am at a loss.
Asked
Active
Viewed 2,412 times
1
-
Did you want the path to a specific user's documents when someone logs in, or their own(i.e. I'm logged in as John, but I want a variable to access Jane's documents, or I am John I want to access my own Documents)? – AndrewSmiley Aug 05 '15 at 14:24
-
I am John I want to access my own Documents. And then I am Jane I want to open my own Documents. – icebird76 Aug 05 '15 at 14:44
-
Updated code in my answer. Should be what you need. Unless you need to create an alias. – AndrewSmiley Aug 05 '15 at 14:48
1 Answers
1
There is no environment variable for this. You'll need to set one. Here's a list of all Windows default environment variables:
*This is for XP, but should be the same for newer versions of Windows
For a single terminal session, you can just use
set USERDOCS=%USERPROFILE%\Documents
For all terminal sessions, you'll need to set a system environment variable. You can do this using the GUI or using setx -m USERDOCS %USERPROFILE\Documents
, as described here.
The command to make this happen would be
explorer %USERDOCS%
But if you wanted to make an alias to that (i.e. a openuserdocs
command), I can update and explain.

Community
- 1
- 1

AndrewSmiley
- 1,933
- 20
- 32
-
1%USERPROFILE% is what I was looking for! I use VBA, so I could just use 'strPath = "%USERPROFILE%\Documents"' to save files to be used by one user only. – icebird76 Aug 05 '15 at 14:54