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.

Are there any other commands similar to the %temp% command in windows.

For example is there one for My documents or application data?

share|improve this question

4 Answers 4

up vote 6 down vote accepted

%TEMP% is not a command, it is an environment variable. To see all your environment variables, execute the set command. Among others, you should see USERPROFILE whose value is the directory above My Documents. You can also execute set /? to read more about the set command.

share|improve this answer
    
The My Documents folder is not necessarily in the %USERPROFILE% folder. That may be the default location, but on all my systems it's been moved, usually to something like `D:\My Documents in an effort to keep it off of the operating system's volume. The path to its current location is stored in the registry and is not available in any environment variables AFAIK. –  martineau Jun 10 '11 at 1:49

%TEMP% is not a command; it's an environment variable. See this list for some examples for Windows.

share|improve this answer

There are lists of environment variables too.

share|improve this answer

Unfortunately there's no standard system-defined environment variable containing the path to the current user'sMy Documentsfolder for you to use.

However, since it is stored in the Windows registry, its value can be copied into an environment variable of you own making using the batch file commands I found shown below -- taken from this old web post by @eibgrad which places it into one named%my_docs%:

set reg_key="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
set reg_val="Personal"
set reg_query='reg query %reg_key% /v %reg_val%'
for /f "eol=; skip=4 tokens=3*" %%i in (%reg_query%) do set my_docs=%%i %%j
if "%my_docs:~,13%" == "%%USERPROFILE%%" set my_docs=%USERPROFILE%%my_docs:~13%
echo %my_docs%

I added an extra line at the end to print out the value found.

share|improve this answer

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.