How can I uninstall MiKTeX on Windows using the command line?

It is possible to remove MiKTeX from your computer using the command line. Open a command prompt window as administrator and execute these commands:

rmdir /S /Q "%PROGRAMFILES%\MiKTeX 2.9"
rmdir /S /Q "%PROGRAMFILES(x86)%\MiKTeX 2.9"
rmdir /S /Q "%PROGRAMDATA%\MiKTeX"
rmdir /S /Q "%APPDATA%\MiKTeX"
rmdir /S /Q "%LOCALAPPDATA%\MiKTeX"
rmdir /S /Q "%LOCALAPPDATA%\Programs\MiKTeX 2.9"
rmdir /S /Q "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\MiKTeX 2.9"
rmdir /S /Q "%APPDATA%\Microsoft\Windows\Start Menu\Programs\MiKTeX 2.9"
reg delete HKCU\Software\MiKTeX.org
reg delete HKLM\SOFTWARE\MiKTeX.org