
$content = @"
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\.avs]

[-HKEY_CLASSES_ROOT\.avsi]

[-HKEY_CLASSES_ROOT\AVIFile\Extensions\AVS]

[-HKEY_CLASSES_ROOT\avs_auto_file]

[-HKEY_CLASSES_ROOT\avsfile]

[-HKEY_CLASSES_ROOT\CLSID\{E6D6B700-124D-11D4-86F3-DB80AFD98778}]

[-HKEY_CLASSES_ROOT\Media Type\Extensions\.avs]

[-HKEY_CURRENT_USER\Software\AviSynth]

[-HKEY_LOCAL_MACHINE\SOFTWARE\Avisynth]

"@

# delete reg keys
$path = Join-Path $env:TEMP Uninstall-AviSynth.reg
$content > $path
Start-Process $path -Wait
Remove-Item $path

# remove from PATH
$path = [Environment]::GetEnvironmentVariable('Path', 'User')
$dir = $PSScriptRoot + '\..\AviSynth'
$dir = Convert-Path $dir

if ($path.Contains($dir)) {
    $path = $path.Replace($dir, '')
    $path = $path.Replace(';;', ';')
    $path = $path.TrimEnd(';')
    [Environment]::SetEnvironmentVariable('Path', $path, 'User')
}
