Solved

"My Documents" variable

Posted on 2006-07-18
5
1,056 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Disclosure: Use this tutorial only when no other options helps to get Windows XP running without any problems and you don't want to format the drive. The back up of the data is the responsible of the user, however there is a description of how t…
Are you unable to synchronize your OST (Offline Storage Table) file with Microsoft Exchange Server? Is your OST file exceeding 2 GB size limit? In Microsoft Outlook 2002 and earlier versions, there is a 2 GB size limit for the OST file. If the file …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now