How to Solve the "Stuck at 42%" / DirectX9 Install Issue
After a few hours of trouble shooting, I was finally able to identify and resolve the issue preventing the installation of Anthem, and from what I understand, many other games on the Origin platform. Hopefully, this helps others get beyond hours of frustration as well.
Ideally, Origin should be checking for these conditions and reporting them to end users for a simple remedy, but it might be helpful for a mod to sticky this and other posts like it.
The Solution:
1. Check the Install.log file in the \Anthem\__Installer folder.
This folder is wherever you have configured the Origin client to install games. If you're not sure where that is, check your Application Settings under the Origin menu (at the top of your Origin client) and click on the Install & Saves tab to see what you have configured. By default, it's under C:\Program Files (x86) somewhere.
Look at the end of the Install.log file. If you see "Error installing DirectX runtime. Please check DirectX install log file typically in C:\Windows\Logs\DirectX.log.", then it's a DirectX installation issue. More details can be found in C:\Windows\Logs\DXError.log as well.
If the error being reported is Error 193 (%1 is not a valid Win32 application), then it's a path problem and it's solvable. More than likely, you're on a newer version of Windows (like Windows 10) that handles spaces in paths/directory gracefully. Older versions of windows and windows programs did not, and DirectX9 is old dating back to 2005.
If the error being reported is Access Denied, then it's a permissions problem and running Origin as an Administrator (right click Run as Administrator) should resolve the issue.
2. Go to Control Panel -> System and Security -> System and click on Advanced System Settings on the menu to the left. This will open up a dialog window.
3. In the dialog window, click on the Advanced tab and then on the Environment Variables button near the bottom. This will open up another dialog window.
4. In the Environment Variables window, select TEMP in the User Variables section and then click Edit to change its value. This opens a dialog box. In the Variable Value field of the dialog box, copy what's there and save it somewhere for later. Now type in a new path that does not have a space in it. You can use C:\Windows\Temp or some other temp folder that DOES NOT HAVE A SPACE in it. Click OK when done.
NOTE: If you're on windows 10 and your username is your Firstname Lastname, as it commonly is, this is where the problem exists. What the default TEMP location is can vary by Windows versions, from one manufacturer to the next or even from one installtion to the next depending on who is administering your PC, which is why this problem affects some people but not others.
5. Repeat step 4 for the TMP variable. This is typically the same as TEMP.
6. Click OK at the bottom of the Environment Variables window and then again in the System Properties window.
7. Exit the Origin client. Make sure it's completely shut down.
8. Open up your \Anthem\__Installer\directx\redist folder in File Explorer and just delete everything in there.
9. Restart your Origin client and log in. The Anthem installation should auto resume. Once it completes the file verification, it will begin to redownload the missing CAB files you deleted and start reinstalling DirectX9.
10. And that's it!
Conclusion:
Once Anthem finishes installing, you can either leave your TEMP and TMP paths with their new values (this should be totally fine if it's your computer and you're not sharing it with anyone else) or change them back to what they were. If you have a data partition (like a D drive), it might improve performance and reduce hard drive fragmentation if you move your temp folders there. However, this is not advisable if you're concerned about security, like when sharing a computer with other people, as it would expose application data that's typically secured under your user profile directory.