As it turns out, there are two main causes that will end up producing the error code on Windows computers:
Method 1: Disabling 3rd Party AV (if applicable)
If you’re using a 3rd party suite like Norton (AV + Firewall) or Panda Global Protection, chances are you’re dealing with an overprotective suite that is blocking the communications with the iTunes sever due to a false positive. If this scenario is applicable, you should be able to fix this problem by disabling the 3rd party suite while you are performing the action in iTunes. Of course, this process will be different depending on the 3rd party suite that you’re using. However, in most cases, you will be able to disable the real-time protection directly from the tray bar menu. Simply right-click on your AV icon and look for an option that allows you to disable the real-time connection. Once you manage to disable the real-time protection, open iTunes again, and repeat the action that was causing the -50 error code in iTunes. Note: If you are using a 3rd party AV that includes a firewall component, disabling the real-time protection will likely not be enough. In this case, you might need to uninstall the AV suite and remove remnant files to complete the operation. If this scenario is not applicable or you already disabled the 3rd party suite with no improvement, move down to the next method below.
Method 2: Reinstalling iTunes
According to some affected users, this issue can also be facilitated by some kind of corruption originating from the iTunes installation folder. In this case, reinstalling the iTunes program or app should allow you to clear the -50 error code and utilize the program normally. In most cases, this issue is reported to occur after an AV ended up quarantining some items belonging to the main iTunes application or to dependencies like the Bonjour app. But keep in mind that depending on the type of iTunes application you’re using (desktop or UWP), the fix will be different. If you’re using the desktop app, you’ll need to use the Programs and Features menu to do the uninstallation manually and then re-download the program from the official channels. However, if you’re using the UWP (Universal Windows Platform) iTunes version of Windows 10, you can fix this issue simply by resetting the app via Windows Store. Depending on the scenario in which you find yourself in, follow the sub-guide applicable to the iTunes version that you’re currently using:
A. Reinstalling the UWP version of iTunes (Windows 10 Only)
B. Reinstalling the Desktop Version of iTunes
How to Fix “Unable to execute file in the temporary directory” Error on Windows…Fix: iTunes ’there is a problem with this windows installer package’FIX: Can’t Delete Temporary Files on Windows 10Fix: Windows created a temporary paging file