Fix: The System Could not Find the Environment Option

A reset is the last resort

Reading time icon 10 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

Key notes

  • The ENVVAR NOT FOUND error usually comes followed by The system could not find the environment option that was entered message.
  • As the message suggests, this system error is often caused by a missing environment variable, but we can’t exclude possible malware infection.

ERROR ENVVAR NOT FOUND usually comes followed by The system could not find the environment option that was entered message.

This is a system error, and it can occur on any Windows operating system, including Windows 10. Since this error is somewhat common, we will show you how to fix it properly.

What does The system could not find the environment option that was entered error mean?

The error message The system could not find the environment option that was entered typically indicates that a command or program is attempting to reference an environment variable that does not exist or cannot be found. This error message can have various causes, including:

  • Typographical errors – Misspelling or mistyping environment variables in a command or script can cause this error.
  • Missing environment variables – This error message can occur if the referenced environment variable is not defined.
  • Corrupted system files – System files associated with environment variables may be damaged or corrupted, causing this error message to appear.
  • Registry errors – Errors in the system registry may cause environment variables to be deleted or misconfigured, leading to this error message.
  • Malware or virus infections – Malware or viruses can corrupt system files and cause this error message.
  • Incorrect system configurations – This error message may appear if the system is not configured correctly or has a conflict between different system settings.

It’s important to note that this error message can appear in various contexts, including when running programs or scripts, installing software, or modifying system settings. The specific cause of the error will depend on the context in which it appears.

How can I fix the system could not find the environment error?

1. Scan your PC for viruses

  1. Type Windows Security in the Search bar, and click on the relevant search result.
    the system could not find the environment option that was entered
  2. Now, click on Virus & threat protection here.
    the system could not find the environment option that was entered
  3. Click on Scan options.
    the system could not find the environment option that was entered
  4. Now, select Full scan and click on the Scan now button at the bottom.
    the system could not find the environment option that was entered

Another common cause for these types of problems is malware infection. Sometimes malware can change your system and cause this and many other errors to appear.

If you suspect your PC is infected by malware, we advise you to perform a full scan as soon as possible. But for that, you will need a powerful and reliable antivirus.

We recommend you get an antivirus with a high detection rate, run a full PC scan, and remove any threats found.

Reliable antiviruses have powerful firewalls, a good privacy policy, and multiple layers of protection to ensure your PC is fully secure.

Of course, using great antivirus also protects you online by blocking potentially dangerous websites.

One of the safest antivirus options we recommend is the ESET HOME Security Essential tool because it has high detection rates and robust multi-layered protection technology that removes any cyber threat.

ESET HOME Security Essential

Get access to powerful antivirus technology and keep your PC safe at all times.
Free Trial Visit Website

2. Add the missing environment variable

2.1 Using Advanced system settings

  1. Click the Power button from the Start menu, and while holding the Shift key pressed, click the Restart option.
  2. Click on Troubleshoot, then on Advanced options.
    the system could not find the environment option that was entered
  3. Select Startup Settings and click the Restart button.
  4. Press the appropriate key to enter Safe Mode.
  5. Press Windows Key + S, enter advanced settings and choose View advanced system settings from the results.
  6. The system Properties window will now appear. Click on Environment Variables button.
  7. Go to the System variables section and click on New.
  8. Enter windir as Variable name and C:Windows as Variable value. Click OK to save changes.
  9. After saving your changes, restart your PC and check if the problem is resolved.

Windows uses environment variables to access certain files faster.

These variables are related to system directories. If a certain variable is missing or not configured properly, you can get The system could not find the environment option that was entered error message.

This issue can appear if %WINDIR% variable is missing.

Performing this solution from Safe Mode is not mandatory, so you can try it without entering it.

This issue can occur due to other missing environment variables, so you should compare the list containing these options with another working PC to find out which are missing.

If you find any discrepancies, you can edit the environment variable list and add the missing one with the help of this guide.

2.2 Using the Registry

  1. Press Windows Key + R, enter regedit, and press Enter or click OK.
  2. In the left pane, navigate to: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
  3. If the windir value is missing, you need to recreate it. Right-click the space in the right pane, choose New, then select String Value.
  4. Enter windir as the name of the new string.
  5. Double-click the newly created windir string to open its properties. Enter C:Windows as Value data and click OK to save changes.
  6. Close the Registry Editor and restart your PC to apply the changes.

This solution is provided if you can’t access Advanced System Settings. Modifying the registry can be potentially dangerous so we advise you to create a backup just in case.

If the windir value is present in your registry, another missing environment variable may be causing this issue. You must find the missing variable and add it manually to the registry.

3. Install Visual C++ Redistributables

  1. Press Windows + R, type appwiz.cpl, and hit Enter.
  2. Click your Visual C++ Redistributables version and select Uninstall.
  3. Visit Microsoft’s website and download a new Visual C++ Redistributable and install it.

Many applications require Visual C++ Redistributable to run properly, and if this component is missing, you might encounter The system could not find the environment option that was entered message.

Users reported that this error usually occurs when trying to start a specific game, and if that’s the case, you can find the necessary files in the _CommonRedistvcredist directory.

This directory is located in the game’s installation folder, and you just have to run the setup files from vcredist folder to fix the issue.

Remember that many versions of Visual C++ Redistributables are available, so you might have to download some older versions as well, depending on the application you’re trying to run.

These components come in 32-bit and 64-bit versions, and if you’re using a 64-bit system you’ll need to install both versions. After installing the necessary redistributables, the problem should be completely resolved.

4. Perform an SFC scan

  1. Search for cmd and click on Run as administrator to open Command Prompt from the list.
  2. Enter the script below and hit Enter.
    sfc /scannow
  3. This process can take a while, so try not to interrupt it.

5. Reinstall Unifi and Java

  1. Press Windows + R, type appwiz.cpl, and hit Enter.
  2. Click on the software you need to reinstall from the software list, in this case, Java, and select Uninstall. Do the same for Unifi.
  3. Download a new Java version and a new Unifi version and install them.

Several users reported this problem while trying to run Unifi. According to them, they fixed the problem by reinstalling Java and Unifi.

After doing that, the issue was completely resolved, and they could reaccess Unifi without problems.

If you’re having this issue with any other application, we suggest you reinstall it and check if that solves the problem.

6. Modify your registry

  1. Press Windows Key + R, enter regedit, and press Enter or click OK.
  2. In the left pane, navigate to:
    Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
  3. In the right pane, right-click the space and choose New and select DWORD (32-bit) Value.
  4. Enter IRPStackSize as the name of the new DWORD and double-click it to open its properties.
  5. In the Data Value field, enter the appropriate value for your network and click OK (the supported values are from 11 to 50).

Modifying the registry can lead to system instability; therefore, we strongly advise you to create a backup in case anything goes wrong.

Remember that the system could not find the environment option that was entered issue occurs while working on C# projects meaning that this solution won’t work for most standard users.

7. Copy msvcr71.dll to the Tomcat installation directory

This solution applies to developers that use Java and Tomcat. If you’re not a developer using Tomcat, you can skip this solution.

Several developers reported this issue with Tomcat, but you can fix it by copying msvcr71.dll from the Javabin to Tomcatbin directory on your PC. After doing that, you should be able to use Tomcat without issues.

8. Perform a System Restore

  1. Search for create a restore point and click on it from the results.
  2. Click on the System Restore button.
  3. Select Choose a different restore point option and click Next.
  4. Check Show more restore points option in the bottom right corner, choose the desired restore point, and click on Next.
  5. Follow the instructions on the screen to complete the restore process.

If, for some reason, System Restore doesn’t work, you can try to perform it from Safe Mode. We showed you how to run Windows 10 in Safe Mode in solution number 2, so be sure to check it for extra instructions.

If The system could not find the environment option that was entered problem doesn’t appear in Safe Mode, and your user profile is likely corrupted, but you can fix the problem by creating a new profile.

9. Create a new user profile

  1. Press the Windows Key + I to open the Settings app.
  2. Go to Accounts section, then to Family & other users, and click on Add someone else to this PC.
  3. Click on I don’t have this person’s sign-in information.
  4. Select Add a user without a Microsoft account.
  5. Enter the user name for the new user and click on Next.

After creating a new user account, check if the problem reappears. If not, you’ll have to move your files to the new account and use it as your main account.

If the problem is still there, you might have to reset Windows 10. Read on to learn how you can do that.

10. Reset Windows 10

  1. Open the Start Menu, click the Power button, press and hold the Shift key on your keyboard and click the Restart option.
  2. Click on Troubleshoot, and then on Reset this PC.
    the system could not find the environment option that was entered
  3. If you already have a backup of your files, feel free to choose the Remove everything option. Otherwise, you might prefer the Keep my files option.
  4. If you are prompted, insert the Windows 10 installation media.
  5. Choose your version of Windows and select Only the drive where Windows is installed (your system drive and all files on it will be removed).
    the system could not find the environment option that was entered
  6. Choose Just remove my files option.
  7. Ensure all your important files are backed up, and click the Reset button.
  8. The reset process will now start. It might take a while, so you need to wait until it finishes.

This process will remove all files from your primary partition, so we advise you to back them up. This procedure can sometimes require Windows 10 installation media, so create one using the Media Creation Tool.

After the process is completed, you’ll have a fresh installation of Windows 10, and all problems with this error will be resolved. Now, you have to restore all your files and install applications.

This is a drastic solution, and we suggest performing it only if all other solutions can’t fix the problem.

ERROR_ENVVAR_NOT_FOUND and The system could not find the environment option that was entered messages can cause many problems on your PC, but in most cases, you can fix these by checking environment variables.

If the issue persists, try any other solution from this article. For any additions or suggestions, use the comments section below.

More about the topics: System Errors