If you're unsure how to resolve the SET_ENV_VAR_FAILED BSOD error, you don't need to worry. This guide for Partition Magic explains the possible causes of the error and provides several effective solutions to fix it.

What Causes the SET_ENV_VAR_FAILED BSOD Error?

The SET_ENV_VAR_FAILED is a blue screen error. Its bug check value is 0x0000005B. It often occurs when the system is unable to set an environment variable. After investigating extensive user reports and posts, I find that the error can mainly be triggered by these reasons:

  • The registry is corrupt on the computer.
  • Incorrect syntax or invalid characters in the environment variable being set.
  • Insufficient permissions to modify environment variables.
  • There are corrupted system files.
  • There are outdated device drivers on your PC.
  • Hardware issues on the PC.
  • Third-party software interference.

Have you also come across the same error on your PC? If so, continue reading to get some solutions.

Editor’s choice: Blue screen error can cause data loss easily, including the SET_ENV_VAR_FAILED 0x0000005B error. I highly recommend you use MiniTool Partition Wizard’s Data Recovery feature to recover all your data to another safe location before you try other advanced ways to fix the error.

MiniTool Partition Wizard DemoClick to Download100%Clean & Safe

How to Download and Install KB5055521 & Fix Update Issues?
How to Download and Install KB5055521 & Fix Update Issues?

This post offers a full guide to show how to download and install KB5055521 and provides some effective solutions to troubleshoot the KB5055521 not installing issue.

Read More
Tips:
If you are unable to access Windows, boot into safe mode before attempting these solutions.

Way 1. Checking System Variables

As the SET_ENV_VAR_FAILED BSOD is related to the system environment variable, you can try checking the system variables first to fix the error. Here’s the guide:

Step 1. Press the Win + X keys simultaneously to open the Quick Link menu, and select System from the menu.

Step 2. In the pop-up window, scroll down to find and click Advanced system settings.

Step 3. In the System Properties window, click the Environment Variables button.

click Environment Variables

Step 4. In the Environment Variables window, verify that all variables are correctly set and none are missing. Check both user and system variables.

Step 5. If any variables are missing or incorrect, add or modify them by clicking on New or Edit.

Way 2. Temporarily Disable the Third-Party Antivirus

Sometimes, the antivirus programs may interfere with environment variable settings. So, if you are using a third-party antivirus to protect your computer from viruses and malware infections, you can try disabling it to fix the SET_ENV_VAR_FAILED blue screen error.

Way 3. Update/Reinstall Device Drivers

Outdated or incompatible device drivers can cause various errors, including the SET_ENV_VAR_FAILED BSOD error. In this case, you can try updating outdated drivers or reinstalling incompatible drivers to fix the error. Here are the detailed steps:

Step 1. Open the Quick Link menu, and select Device Manager from the menu.

Step 2. In the Device Manager, expand the category that contains the outdated drivers.

Step 3. Right-click the outdated driver and select Update driver.

select Update driver

Step 4. Select Search automatically for drivers in the Update drivers window. Then, follow the on-screen guide to complete the process.

Step 5. Repeat the same steps to update all the outdated drivers.

If there are incompatible drivers on your PC, you can just expand the category that contains the incompatible driver. Right-click it and select Uninstall device, and then follow the on-screen guide to finish the process.

Way 4. Run SFC and DISM Scan

Corrupted system files can cause the SET ENV VAR FAILED BSOD error easily. Therefore, you can try running SFC and DISM scans to fix the error. Here’s the way:

Step 1. Press the Win + R keys simultaneously to open the Run window.

Step 2. Type “cmd” in the box, and press Ctrl + Shift + Enter keys simultaneously to run Command Prompt as administrator.

Step 3. In the elevated Command Prompt window, type “sfc /scannow” and press Enter.

Step 4. Once the process is complete, restart your PC and check if the error has been resolved. If not, repeat the first 2 steps and perform the DISM commands in the elevated Command Prompt window to fix the SET_ENV_VAR_FAILED 0x0000005B error:

  • DISM.exe /Online /Cleanup-image /Scanhealth
  • DISM.exe /Online /Cleanup-image /Checkhealth
  • DISM.exe /Online /Cleanup-image /Restorehealth

Way 5. Perform a Clean Boot

Executing a clean boot allows Windows to start with only essential drivers and startup programs, making it simpler for you to identify the cause of the SET ENV VAR FAILED BSOD error. You may want to give it a shot. Here’s the guide:

  1. Open the Run window, type “msconfig” in the box and press Enter to open the System Configuration window.
  2. Select the Services tab, and check the Hide all Microsoft services option.
  3. Click on the Disable all button and then click on the Apply button.
  4. Next, go to the Startup tab, and click on Open Task Manager.
  5. Right-click the applications you suspect and select Disable option from the menu.
  6. Exit Task Manager and then click OK under the Startup tab. 
  7. Then, when you restart the computer, it is in a clean boot environment. 
  8. Next, see if the problem occurs. If not, enable one program one by one until the problem occurs again. That program might be the source of the error. You’d better consider removing it.

Way 6. Try Some Advanced Ways

If none of the above ways can help you fix the SET_ENV_VAR_FAILED blue screen error, you can try some other advanced ways to fix the error, such as:

Bottom Line

This is the end of the post. Now, you may already know how to fix the SET_ENV_VAR_FAILED BSOD error. You can try the above ways one by one until you fix the error successfully.

  • linkedin
  • reddit