:: Take ownership of the folders
TakeOwn /F "C:\Program Files\Windows Mail" /R /D Y
TakeOwn /F "C:\Program Files (x86)\Windows Mail" /R /D Y
:: Grant full control to Administrators, the user running this, and SYSTEM
ICACLS "C:\Program Files\Windows Mail" /T /Grant:R "Administrators":(OI)(CI)F
ICACLS "C:\Program Files\Windows Mail" /T /Grant:R %UserDomain%\%UserName%:(OI)(CI)F
ICACLS "C:\Program Files\Windows Mail" /T /Grant:R "SYSTEM":(OI)(CI)F
ICACLS "C:\Program Files (x86)\Windows Mail" /T /Grant:R "Administrators":(OI)(CI)F
ICACLS "C:\Program Files (x86)\Windows Mail" /T /Grant:R %UserDomain%\%UserName%:(OI)(CI)F
ICACLS "C:\Program Files (x86)\Windows Mail" /T /Grant:R "SYSTEM":(OI)(CI)F
:: Unhide WinMail.exe
Attrib -S -H "C:\Program Files\Windows Mail\WinMail.exe"
Attrib -S -H "C:\Program Files (x86)\Windows Mail\WinMail.exe"
:: Delete the WinMail folders
RD /S /Q "C:\Program Files\Windows Mail"
RD /S /Q "C:\Program Files (x86)\Windows Mail"