44 lines
1.7 KiB
PowerShell
44 lines
1.7 KiB
PowerShell
# Satsuma uninstaller. Run it with Uninstall.bat.
|
|
$ErrorActionPreference = 'Continue'
|
|
|
|
$root = Join-Path $env:LOCALAPPDATA 'Satsuma'
|
|
$classes = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey('Software\Classes\SystemFileAssociations', $true)
|
|
$removed = 0
|
|
|
|
if ($null -ne $classes) {
|
|
foreach ($name in $classes.GetSubKeyNames()) {
|
|
$shell = $classes.OpenSubKey($name + '\shell', $true)
|
|
if ($null -ne $shell) {
|
|
if ($shell.GetSubKeyNames() -contains 'Satsuma') {
|
|
try { $shell.DeleteSubKeyTree('Satsuma', $false); $removed++ } catch { }
|
|
}
|
|
$shell.Close()
|
|
}
|
|
}
|
|
$classes.Close()
|
|
}
|
|
Write-Host ('Removed the right-click menu from ' + $removed + ' file types.')
|
|
|
|
$marker = Join-Path $root 'classic-menu.txt'
|
|
if (Test-Path -LiteralPath $marker) {
|
|
$a = Read-Host 'Satsuma turned on the classic Windows 11 right-click menu. Put the new Windows 11 menu back? (Y/N)'
|
|
if ($a -match '^[Yy]') {
|
|
try {
|
|
[Microsoft.Win32.Registry]::CurrentUser.DeleteSubKeyTree('Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}', $false)
|
|
Write-Host 'Done. Sign out and back in (or restart) to see the change.'
|
|
} catch { }
|
|
}
|
|
}
|
|
|
|
if (Test-Path -LiteralPath $root) {
|
|
Remove-Item -LiteralPath $root -Recurse -Force -ErrorAction SilentlyContinue
|
|
if (Test-Path -LiteralPath $root) {
|
|
Write-Host 'Some files in the Satsuma folder could not be deleted (they may be in use). Delete this folder by hand:'
|
|
Write-Host $root
|
|
} else {
|
|
Write-Host 'Deleted the Satsuma program folder, including the downloaded tools.'
|
|
}
|
|
}
|
|
Write-Host ''
|
|
Write-Host 'Satsuma is removed.'
|