Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1070
  • Last Modified:

"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?
0
stakor
Asked:
stakor
  • 2
  • 2
1 Solution
 
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
 
mastooCommented:
I think this might be fairly universal:

"%USERPROFILE%\My Documents"
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now