"My Documents" variable

If I wanted to write a batch file that would go to the user's my documents folder, how would I refer to the location?

For instance, to go to the directory that they are running windows out of I would try to cd to %systemroot%. Is there a corresponding variable for My Documents?
stakorAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mastooConnect With a Mentor Commented:
I think this might be fairly universal:

"%USERPROFILE%\My Documents"
0
 
GeisrudSystems AdministratorCommented:
%HOMEPATH%\my documents

Is as close as I can think of
0
 
stakorAuthor Commented:
When I do:

cd %HOMEPATH%

I end up in the root directory of C:\ . I'll check on a nother machine, in case it's something funky with this machine.
0
 
stakorAuthor Commented:
Ok, on a 2003 machine, it works just fine. On the second Win XP machine I tried, I ended up at the same point. (root directory of the drive)
0
 
GeisrudSystems AdministratorCommented:
As near as I can tell, what I suggested %HOMEPATH%\my documents and what mastoo suggested %USERPROFILE%\My Documents take you to the same place
0
All Courses

From novice to tech pro — start learning today.