'eval' is not recognized as an internal or external command

Borislav Hadzhiev

Last updated: Apr 4, 2024
3 min


# 'eval' is not recognized as an internal or external command

The error "'eval' is not recognized as an internal or external command, operable program or batch file" occurs when we try to use the eval command in a Windows shell.

To solve the error, use the command in Git Bash, or a bash session in cmder, or use an equivalent Windows command.

eval is not recognized as internal or external command

One way to solve the error is to start a bash session in cmder and then issue the eval command.

# 👇️ start bash bash eval echo "hello world" eval $(ssh-agent)

cmder use eval

If you get an error that "Windows subsystem for Linux has no installed distributions":

  1. Click on the Search bar and type CMD.

  2. Right-click on the Command Prompt application and click "Run as administrator".

run cmd as administrator

  1. Issue the following command as an administrator.
wsl --install -d Ubuntu
  1. Wait for the installation to complete, start bash and use the eval command.
bash eval echo "hello world" eval $(ssh-agent)

If you are trying to run ssh-agent on Windows in CMD, try using the start-ssh-agent command instead.

start-ssh-agent start-ssh-agent.cmd

start ssh agent cmd

Alternatively, you can use the eval command in Git Bash by installing git on your Windows machine.

If you already have git installed, you can search for Git Bash and use the eval command, otherwise, you have to install git first.

# Running the eval command in Git Bash

To download git and be able to use Git Bash:

  1. Open the git downloads page and download the installer for Windows.
  2. Start the installer.
  3. You will be prompted to select a destination location. You can leave the default option and click Next.

git select destination location

  1. You will be prompted to select components on the next screen. Leave the default options and click Next.

git select components

  1. Click Next on the screen that prompts you to "Select Start Menu Folder".

  2. On the next screen, you can choose the default editor for Git, e.g. Notepad, Notepad++ or any other editor you prefer.

choose git default editor

  1. On the "Adjust the name of the initial branch in new repositories screen", click Next.

adjust name of initial branch

  1. On the "Adjust your PATH environment" screen, make sure you have the default option of "Git from the command line and also from 3rd-party software" option selected and click "Next".

adjust your path environment

  1. For all the remaining screens, leave the default option selected and click Next.
  2. Lastly, click on the Install button to install git.

Once you have git installed, click on the Search field, type "Git Bash" and start the application.

search for git bash

Now you can use the eval command directly in Git Bash.

eval echo "example.com" eval $(ssh-agent)

using eval in git bash

If you need to open Git Bash in a specific folder:

  1. Open the folder in a new window.
  2. Right-click in Explorer.

search for git bash

  1. Click "Git Bash Here".

  2. Issue the eval command.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.