OK, so i'm trying to write some code to save a file in my default documents library in windows 7... This is not C:\Users\username\Docuements as is default... I have added another folder in my root D:\ to handle documents.

Normally when I save a file using word or any other program, it will save it to the correct location (D:\Documents), however the code I am using Environment.GetFolderPath(Environment.SpecialFolder.Personal) is always returning C:\Users\username\Documents.. and I don't want my files to be saved there. Does anybody know how to get it to save to the D drive folder? I ask this because I want this program to be portable on other systems (including non windows 7) so it will go to their my documents as required.

The problem is that I don't want to use a dialogue box... What i'm doing is making a program to automate the backup of my USB stick when I plug it in - it will automatically copy all the files from it to a folder in my documents... Its just that the location of "my documents" is up in the air, between XP and 7.

turns out I could not find any solution to this problem - the only method that would work is to change the location of my documents on my PC to point to the same location as my "library". Unfortunate.

You could use a directory selector dialog to allow overriding of the my documents path. Once a user overrides it then you could save the value in your application's config file so you won't have to deal with the dialog again. You would have automation and portability.

This question has already been answered. Start a new discussion instead.