# 2_Move_System_Folders.ps1
$D_Doc = "D:\Document"

# 定义注册表键名与 D 盘新路径的对应关系
$Folders = @{
    "Desktop"   = "$D_Doc\Desktop"
    "Personal"  = "$D_Doc\Documents"
    "{374DE290-123F-4565-9164-39C4925E467B}" = "$D_Doc\Downloads" # Downloads 键名
    "My Pictures" = "$D_Doc\Pictures"
}

$RegistryPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"

foreach ($Key in $Folders.Keys) {
    $NewPath = $Folders[$Key]
    
    # 创建 D 盘目录
    if (!(Test-Path $NewPath)) { New-Item -Path $NewPath -ItemType Directory -Force }

    # 修改注册表
    Set-ItemProperty -Path $RegistryPath -Name $Key -Value $NewPath
    Write-Host "[成功] $Key 路径已改为 $NewPath" -ForegroundColor Green
}

Write-Host "提示：请重启电脑或重新启动 Windows 资源管理器以应用更改。" -ForegroundColor Yellow