Location of ‘My Documents’

65 pts.
Tags:
My Documents
Visual Basic
On my XP computer, the location of 'My Documents' is C:\documents and settings\dan shelby\my documents. On my friends XP computer, the location of 'My Documents' is: documents and settings\owner\my documents. Since Windows invented the folder "My Documents" it does seem like the location of it should be the same for the same version of windows. Also, Visual Basic, another MicroSoft Windows product, allows a programmer to identify where the program is being executed by querying app.path. It seems like MicroSoft would also have provided the development programmer with something, such as app.documents to identify the location of "My Documents". Apparently, this test editor doesn't print the backslash. The paths given above should have the backslash between the word settings and the next word. Also, between the word My and the previous word.

Software/Hardware used:
Windows XP - desktop computer

Answer Wiki

Thanks. We'll let you know when a new response is added.

ok instead of writing ”C://documents and settings  etc” you can just type my.computer.filesystem.specialdirectories.mydocuments

NOTE :THIS IS TESTED IN VB 2008 ONLI

Discuss This Question: 9  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Anu143
    Whats the issue you are facing ..
    525 pointsBadges:
    report
  • DanShelby
    My interest is trying to write a program that accesses a file or files stored in the 'My Documents' folder and, then, at a different location on a different computer, run the executable version of that program. If the path to 'My Documents' is different between the two computers, then the attempt to access the file or files will fail.
    65 pointsBadges:
    report
  • DanShelby
    I suppose the easy way is to rename my 'dan shelby' folder to 'owner'; however, the fact remains that a development programmer should be able to identify the location of 'my documents' with readily available information instead of having to do a work-around.
    65 pointsBadges:
    report
  • AndreaF
    If you want your script (or program) to run on a variety of computers, you likely won't be able to rename every one. A wildcard in your string would be the best bet I could think of.i
    8,000 pointsBadges:
    report
  • TomLiotta

    The Configuration of the My Documents folder page describes how this is handled in Windows XP. The two most relevant registry keys are:

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

    In both keys, the 'Personal' value holds the 'My Documents' location data. The page at Microsoft provides a general description of how the two keys can be used.

    A registry search for additional 'Personal' values in the registry can help show how various users on a single system can have different 'My Documents' folders.

    Tom

    125,585 pointsBadges:
    report
  • carlosdl

    In VBScript I have used something like this:

     

    DesktopPath = Shell.SpecialFolders("MyDocuments")
     
    Maybe something similar can be done from VB.
    69,510 pointsBadges:
    report
  • carlosdl

    According to this article, you should be able to read the path this way:

    Dim DirPath As String
    DirPath = System.Environment.GetFolderPath(Environment.SpecialFolder.Favorites)

     

    69,510 pointsBadges:
    report
  • carlosdl

    But, ofcours, it should have been:

    rPath = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
    
    69,510 pointsBadges:
    report
  • carlosdl
    Something's wrong with my keyboard...
    69,510 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following