0

I want to create a simple script to move some of the default user data folders [%UserProfile%\Documents, %UserProfile%\Pictures, etc.] to a different drive, but can't figure out a way to do this via PowerShell or batch.

Does anyone know if there's a way?

JW0914
  • 7,052
  • 7
  • 27
  • 48
Vito RM
  • 1
  • 2
  • What is your use case? Windows has built in functionality to do this called folder redirection that is easily pushed out with GPO. – Appleoddity Feb 16 '18 at 06:48
  • Welcome to Super User. Please read [How do I ask a good question?](https://superuser.com/help/how-to-ask). You are always welcome to ask, but please keep the above in mind. :) – FatalBulletHit Feb 16 '18 at 13:51
  • @VomitIT-ChunkyMessStyle That's an incorrect way to move the locations of the primary User Profile data directories [`%UserProfile%\Documents`, `%UserProfile%\Downloads`, etc.], as this is done via each data directories' _Properties_ → _Location_ tab since these are directories with [KnownFolderID](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid) GUIDs that are apart of the [User Profile](https://docs.microsoft.com/en-us/windows/win32/shell/about-user-profiles) and used by the [Windows Shell](https://en.wikipedia.org/wiki/Windows_shell) – JW0914 Jul 08 '22 at 12:02
  • AFAIK, there is no way to do this via command line _(I've never come across a way on Microsoft Docs, other than when first configuring Windows via an Answer File when Windows is installed or after running `SysPrep` for deployment)_, with @Metaphor's [answer](https://superuser.com/a/1730581/529800) being the only way I'm aware of _(my hunch is this is likely due to User Profile data directories being different than other directories since these are directories with KnownFolderID GUIDs used by the Windows Shell - see prior comment for links)_. – JW0914 Jul 08 '22 at 12:07
  • @JW0914 There's the Microsoft way of doing things, and there's the way of doing things perhaps MS unconventional to meet some need. I've used something similar once for some strange business reason for a desktop folder. That company didn't have GPOs or other ways so I used something like that to suffice for their need and scripted some brute force way to enforce it at every startup should some WU break it. So yes, there could be times people do things to meet their business needs per environment constraints, etc. which MS doesn't document. AFAIK that process still works years later for them. – Vomit IT - Chunky Mess Style Jul 08 '22 at 16:18
  • In any case, I'd use GPO folder redirection rather than some scripted thing if possible for this. That's what I use on enterprise scale for thousands of machines\users now for this sort of thing. I'd have to poke through the policies to remind myself, but there could be some other settings I set in conjunction with the folder redirection, login script, etc. in that environment setup to meet that need. I deleted that old comment though, I use PowerShell usually and not mklink anymore. Not sure what I was thinking back in 2018 when I wrote that. – Vomit IT - Chunky Mess Style Jul 08 '22 at 16:20

0 Answers0