There are pieces of the code that are missing.
You also do NOT need to write a temporary batch file.
As a bmuch better alternative, you should be getting the list of installed software from WMI and the
Win32_Product[
^] class. Each instance has a method called, of course, Uninstall. This will make uninstalling any piece of software much easier than writing a stupid batch file.