How to direct people to access Documents via CLI after they've moved it?

asked 2021-11-07T15:30:40.447+00:00
Nicholas Steel 331 Reputation points

I'm writing a guide for something and I want to be able to direct people to a location in Documents even if they've moved where Documents is located. So far all my attempts end up at "C:\users\username\documents\".

Let's say I moved Documents to "D:\Documents\". When I type %UserProfile%\Documents\ in to Windows Explorer I'm taken to "C:\Users\username\Documents\" instead of "D:\Documents\". The same happens if I try "%AppData\..\..\Documents\".

Documents Location UI: https://imgur.com/a/RIrGn3Y

Edit: I want to be able to include a path to a file or folder in Documents in my guide so that people can copy/paste it in to Windows Explorer or Command Prompt to open the file or location without needing to search around.

If a person moved Documents to "D:\Documents\" and I want them to open the configuration located at "Documents\Fallout 3\Fallout.ini", what would the path look like for them to copy/paste? Every attempt I make produces an error because it searches "C:\users\username\documents\Fallout 3\Fallout.ini" which doesn't exist if the Documents folder has been moved!

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
5,886 questions
No comments
{count} votes

3 answers

Sort by: Most helpful
  1. answered 2021-11-07T15:52:19.023+00:00
    Dave Patrick 328.2K Reputation points Microsoft MVP

    Maybe something here helps.
    https://superuser.com/questions/1132288/windows-command-prompt-get-relocated-users-documents-folder

    --please don't forget to upvote and Accept as answer if the reply is helpful--


  2. answered 2021-11-07T15:55:18.043+00:00
    Castorix31 65,271 Reputation points

    If you explicitly use System environment variables like %UserProfile%,
    it is normal that %UserProfile% + "xxx" gives the value of %UserProfile% concatened with "xxx"...
    If you list the variables with set in a cmd window, you will see the value of %UserProfile%

    No comments

  3. answered 2022-01-28T16:15:13.95+00:00
    Nicholas Steel 331 Reputation points

    Again, what I want to do is include in my guide written instructions that don't involve navigating the registry or using a Command Line parameter etc., I want something dead simple for this scenario but it sounds like that may just not be possible.

    No comments