My Documents - Environment Variable

  • Thread starter Thread starter Peter Billingsworth
  • Start date Start date
P

Peter Billingsworth

I require some information on how WinXP determines where "My
Documents" exists. I'm writing a simple batch file that creates a
file and I want to save it in the "My Documents" folder. I'm having
difficulty doing this on my computer, where I have moved "My
Documents" from it's default location.

Based on my quick internet and Windows search, there is no environment
variable for "My Documents". I have found that I can use
%UserProfie%\My Documents IF that folder hasn't been changed from it's
default location. In my case, I have changed the "default" location
of "My Documents" to my D:\ drive. Obviously, I can use D:\ instead
of an environment variable for my situation, but if someone else has
changed it to a different location, using D:\ in my batch file would
be useless. There must be someway that the system can find "My
Documents" for the current user through an environment variable or
other setting.

Any assistance would be appreciated.

TIA
 
Peter Billingsworth said:
I require some information on how WinXP determines where "My
Documents" exists. I'm writing a simple batch file that creates a
file and I want to save it in the "My Documents" folder. I'm having
difficulty doing this on my computer, where I have moved "My
Documents" from it's default location.

Based on my quick internet and Windows search, there is no environment
variable for "My Documents". I have found that I can use
%UserProfie%\My Documents IF that folder hasn't been changed from it's
default location. In my case, I have changed the "default" location
of "My Documents" to my D:\ drive. Obviously, I can use D:\ instead
of an environment variable for my situation, but if someone else has
changed it to a different location, using D:\ in my batch file would
be useless. There must be someway that the system can find "My
Documents" for the current user through an environment variable or
other setting.

Any assistance would be appreciated.

TIA

Set "My Documents" to something unique and easily
identifiable (e.g. "My Unicorn"), then scan the registry
for this unique string.
 
The My Documents path is stored in the following registry location.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User
Shell Folders

The value named "Personal" contains the full path to the My Documents
folder.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


I require some information on how WinXP determines where "My
Documents" exists. I'm writing a simple batch file that creates a
file and I want to save it in the "My Documents" folder. I'm having
difficulty doing this on my computer, where I have moved "My
Documents" from it's default location.

Based on my quick internet and Windows search, there is no environment
variable for "My Documents". I have found that I can use
%UserProfie%\My Documents IF that folder hasn't been changed from it's
default location. In my case, I have changed the "default" location
of "My Documents" to my D:\ drive. Obviously, I can use D:\ instead
of an environment variable for my situation, but if someone else has
changed it to a different location, using D:\ in my batch file would
be useless. There must be someway that the system can find "My
Documents" for the current user through an environment variable or
other setting.

Any assistance would be appreciated.

TIA
 
Back
Top