0

How to change the paths to user folders (Shell Folders) with Powershell? Required:

  1. get the path to the folder $mydoc = [Environment]::GetFolderPath('MyDocuments') C:\Users\shay\Documents
  2. Change the drive letters in a variable $mydoc - C:\Users\shay\Documents to d:\Users\shay\Documents ??
  3. Create a folder - d:\Users\shay\Documents ??
  4. Copy the folder C:\Users\shay\Documents to d:\Users\shay\Documents ??
  5. Set the path to the My Documents system folder - d:\Users\shay\Documents ?? I am grateful in advance for your help.
mklement0
  • 382,024
  • 64
  • 607
  • 775
antarey
  • 29
  • 5
  • The main part of your question (redefining the locations of known shell folders) is addressed in the linked duplicate. To change the drive letter, use `$mynewdoc = $mydoc -replace '^c', 'd'`. To create a folder, use [`New-Item`](https://learn.microsoft.com/powershell/module/microsoft.powershell.management/new-item). To copy a folder, use [`Copy-Item`](https://learn.microsoft.com/powershell/module/microsoft.powershell.management/copy-item) – mklement0 Jan 13 '21 at 15:44
  • how set the path to the My Documents system folder - d:\Users\shay\Documents ?? – antarey Jan 14 '21 at 12:17
  • Try the function in [this answer](https://stackoverflow.com/a/25709702/45375) to the linked duplicate. – mklement0 Jan 14 '21 at 14:14

0 Answers0