Windows11 ドキュメントフォルダのパス変更

ドキュメントフォルダのPathをOneDriveの下から変更した時の作業ログ。

前提

ドキュメントフォルダ内には何も設置していない状態を想定。

手順

PS C:\Users\username> Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" | Select-Object Personal

Personal
--------
C:\Users\username\OneDrive\ドキュメント

PS C:\Users\username> Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "Personal" -Value "%USERPROFILE%\Documents"

PS C:\Users\username> Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" -Name "Personal" -Value "C:\Users\username\Documents"

PS C:\Users\username> Stop-Process -Name explorer -Force

PS C:\Users\username> Remove-Item -Path "HKCU:\Software\Microsoft\OneDrive" -Recurse -Force

PS C:\Users\username> Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" | Select-Object Personal

Personal
--------
C:\Users\username\Documents