自动删除多个 chrome 个配置文件

Delete multiple chrome profile automatically

所以我用 google chrome 制作了一个机器人来完成一些任务,它创建了许多 google chrome 配置文件。现在我完成了那个任务,所以我想删除我创建的所有 google chrome 配置文件。

注意:

如果您仍然需要这方面的帮助,我制作了一个删除 Google Chrome 的个人资料数据的 PowerShell 脚本。

它停止当前 运行 的任何 chrome 个进程,然后目标:

  • 配置文件 # 和默认目录
  • 本地状态文件

位于:

%LOCALAPPDATA%\Google\Chrome\User Data

$UserData = "$($env:LOCALAPPDATA)\Google\Chrome\User Data"

$Folders = Get-ChildItem $UserData | Where-Object{ $_.PSIsContainer -and $_.Name -eq "Default" -or $_.Name -like "Profile*"}

$FoldersFullPath = $Folders.FullName 


if ($Null -ne (get-process 'chrome' -ErrorAction SilentlyContinue)){
    stop-process -ProcessName 'chrome'
    Start-Sleep -Seconds 5
}

$FoldersFullPath | ForEach-Object {
    if (Test-Path -Path $_){
        Remove-Item -Recurse -Path $_
    }
}

if (Test-Path -Path "$UserData\Local state"){
    Remove-Item -Path "$UserData\Local state"
}

我相信你可以用这个来帮助你re-create它在Python,事实上,这是一个很好的借口来学习Python我自己。