Get directory name of “My Documents”

I’m at a client that has the users “My Documents” on a share drive, so that when you logon to any computer, you have your “My Documents” available.

The question is, how to get that directory/path name?

Why? You might want to write a C# program to access one of the files there, or you might want the path to put in Total Commander as short cut.

There may be better methods, but this is what I did.

I opened PowerShell ISE, and typed in “Get-Location” as the text of my program. I then did a “File Save As”, navigated to the “My Documents” directory and saved it.

I then pressed F5 to run it. It actually failed, but the error at least gave me the path name, as shown below:

<pre>
S C:\WINDOWS\system32> \\abcServerName\Users$\johndoe\My Documents\GetLocation.ps1
File \\abcServerName\Users$\johndoe\My Documents\GetLocation.ps1 cannot be loaded 
because running scripts is disabled on this system. For more information, see 
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
    + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecord 
   Exception
    + FullyQualifiedErrorId : UnauthorizedAccess

</pre>

Uncategorized  

Leave a Reply