プロジェクト

全般

プロフィール

EDGEのプロファイルを一括で削除するPS
$EdgeUserData = "$env:LOCALAPPDATA\Microsoft\Edge\User Data" 

Stop-Process -Name msedge -Force -ErrorAction SilentlyContinue

$profiles = Get-ChildItem $EdgeUserData -Directory |
    Where-Object {
        $_.Name -eq "Default" -or
        $_.Name -match '^Profile \d+$'
    }

foreach ($profile in $profiles) {

    Write-Host "処理中: $($profile.Name)" -ForegroundColor Cyan

    $cachePaths = @(
        "$($profile.FullName)\Cache",
        "$($profile.FullName)\Code Cache",
        "$($profile.FullName)\GPUCache" 
    )

    foreach ($path in $cachePaths) {
        if (Test-Path $path) {
            Write-Host "  削除: $path" 
            Remove-Item $path -Recurse -Force -ErrorAction SilentlyContinue
        }
    }
}

Write-Host "" 
Write-Host "完了" -ForegroundColor Green