How to Fix the SET_ENV_VAR_FAILED Bug Check 0x5B
Check if the environment variables are set correctly
4 min. read
Published on
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
The SET_ENV_VAR_FAILED error comes with the value of 0x0000005B and it is associated with problematic system environment variables. We have a few tested solutions that helped most of the users who encountered this BSoD.
How do I fix the SET_ENV_VAR_FAILED BSoD?
1. Checking system variables
- Press Win + X and select System from the menu.
- Click on Advanced system settings.
- In the System Properties window, click on the Environment Variables button.
- Check if any variables are missing or incorrectly set. Look through both user and system variables.
- If variables are missing or incorrect, add or modify the variables as necessary by clicking on New or Edit.
Ensuring that environment variables are correctly set can resolve issues related to system functionality and application performance since incorrect or missing variables may cause the SET_ENV_VAR_FAILED error.
2. Temporarily disable the third-party antivirus
- Open the antivirus program by double-clicking its icon in the taskbar or searching for it through the Start menu.
- Navigate to the settings or options menu within the antivirus software.
- Look for an option to temporarily disable the antivirus protection. This might be under sections like Real-time protection or Shield control.
- Disable the antivirus temporarily and check if the SET_ENV_VAR_FAILED error persists.
If the error resolves after disabling the antivirus, consider adding an exception for the affected application or switching to a different antivirus program.
Some antivirus programs may interfere with environment variable settings. Disabling the antivirus helps determine if it is the cause of the error.
3. Run a System File Checker (SFC) scan
- Type cmd in the Start menu, right-click on Command Prompt and select Run as administrator.
- In the Command Prompt window, type sfc /scannow and press Enter.
- Follow any instructions provided at the end of the scan.
- Restart your system and check if the error is resolved.
The System File Checker (SFC) tool scans for and restores corrupt system files. This can fix errors related to the misconfiguration of environment variables that lead to the SET_ENV_VAR_FAILED bug check.
4. Run the DISM tool
- Click the Start button, type cmd and select Run as administrator from the results.
- In the Command Prompt window, type the following command and press Enter:Â
DISM /Online /Cleanup-Image /RestoreHealth
- Restart your system once the process is finished.
The Deployment Imaging Service and Management Tool (DISM) repairs system image files and can resolve deeper system corruption that might be causing the SET_ENV_VAR_FAILED error.
5. Update device drivers
- Press Win + XÂ and select Device Manager.
- Expand the categories to find the device you want to update (e.g., Display adapters, Network adapters). If you find a device that has a yellow exclamation mark next to it, treat it with priority.
- Right-click on the device and select Update driver.
- Choose Search automatically for drivers and follow the prompts.
- Repeat for all major devices to ensure they are up to date.
Outdated or incompatible drivers can cause various system errors, including the SET_ENV_VAR_FAILED bug check. Updating drivers ensures that all hardware components work correctly with the OS. It’s also very useful to check for any Windows updates and install them because they also come with new drivers.
6. Perform a Clean Boot
- Press Win + R, type msconfig, and press Enter.
- In the System Configuration window, go to the Services tab.
- Check Hide all Microsoft services and then click Disable all.
- Go to the Startup tab and click on Open Task Manager.
- Disable all startup items by right-clicking on each and selecting Disable.
- Close Task Manager and click OK in the System Configuration window.
- Restart your computer and check if the error persists.
Performing a clean boot helps identify if background services or startup programs are causing the SET_ENV_VAR_FAILED error by starting the computer with a minimal set of drivers and startup programs.
By following these steps, users can systematically troubleshoot and resolve the SET_ENV_VAR_FAILED error, ensuring their Windows system runs smoothly. To prevent similar issues in the future, regularly update your system and drivers, and periodically check your environment variables.
That being said, we have a guide on how to set environment variables in Windows 11. It will help you determine which ones are legitimate and which not.
You may also print environment variables using PowerShell to make things even easier.
For any other questions or suggestions, don’t hesitate to use the comments section below and leave a line.
User forum
0 messages