@ECHO OFF & CD /D %~DP0 & TITLE 卸载
>NUL 2>&1 REG.exe query "HKU\S-1-5-19" || (
    ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs"
    ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs"
    "%TEMP%\Getadmin.vbs"
    DEL /f /q "%TEMP%\Getadmin.vbs" 2>NUL
    Exit /b
)

taskkill /f /im TeamViewer* >NUL 2>NUL

del/f/s/q rolloutfile.tv13 >NUL 2>NUL
del/f/s/q TeamViewer14_Hooks.log >NUL 2>NUL

start /wait /B "" "%~dp0TeamViewer_Service.exe" -uninstall

if "%PROCESSOR_ARCHITECTURE%"=="x86" start /wait /B "" "%~dp0tv_w32.exe" --action remove --id TEAMVIEWERVPN
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" start /wait /B "" "%~dp0tv_x64.exe" --action remove --id TEAMVIEWERVPN

start /wait /B "" "%~dp0TeamViewer.exe" api --uninstall

regsvr32 /s /u outlook\TeamViewerMeetingAddinShim.dll
regsvr32 /s /u outlook\TeamViewerMeetingAddinShim64.dll

ping -n 5 127.0.0.1 >NUL 2>NUL

sc stop TeamViewer >NUL 2>NUL
sc delete TeamViewer >NUL 2>NUL

rd/s/q "%tmp%\TeamViewer"2>NUL
rd/s/q "%AppData%\TeamViewer" 2>NUL
rd/s/q "%LOCALAPPDATA%\TeamViewer"2>NUL
del /q "TeamViewer*.txt"    >NUL 2>NUL
del /q "TeamViewer*.log"    >NUL 2>NUL
del /q "%userprofile%\Desktop\TeamViewer.lnk" >NUL  2>NUL 
del /q "%userprofile%\桌面\TeamViewer.lnk" >NUL  2>NUL 
del /q "%userprofile%\桌面\TV更换ID.lnk" >NUL  2>NUL 
del /q "%userprofile%\Desktop\TV更换ID.lnk" >NUL  2>NUL 
reg delete "HKCU\SOFTWARE\TeamViewer" /f >NUL 2>NUL
reg delete "HKCU\SOFTWARE\TeamViewer Manager" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\TeamViewer" /f >NUL 2>NUL
reg delete "HKLM\SOFTWARE\Wow6432Node\TeamViewer" /f >NUL 2>NUL