Solved

"My Documents" variable

Posted on 2006-07-18
5
1,062 Views
Last Modified: 2006-11-18
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
Comment
Question by:stakor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 14

Expert Comment

by:Geisrud
ID: 17132755
%HOMEPATH%\my documents

Is as close as I can think of
0
 

Author Comment

by:stakor
ID: 17132790
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
 

Author Comment

by:stakor
ID: 17132817
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
 
LVL 21

Accepted Solution

by:
mastoo earned 251 total points
ID: 17132868
I think this might be fairly universal:

"%USERPROFILE%\My Documents"
0
 
LVL 14

Expert Comment

by:Geisrud
ID: 17133493
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

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We have adopted the strategy to use Computers in Student Labs as the bulletin boards. The same target can be achieved by using a Login Notice feature in Group policy but it’s not as attractive as graphical wallpapers with message which grabs the att…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question