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

Borislav Hadzhiev

Last updated: Apr 4, 2024
2 min


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

The error "'ping' is not recognized as an internal or external command, operable program or batch file" occurs when the system's PATH environment variable is not configured correctly on Windows.

To solve the error add %SYSTEMROOT%\system32 to your PATH environment variable.

  1. Click on the Search bar and type "environment variables".
  2. Click on "Edit the system environment variables".

edit system environment variables

  1. Click on the "Environment Variables" button.

click environment variables

  1. In the "System variables" section, select the "Path" variable and click "Edit".

select path and click edit

  1. Make sure you have the %SystemRoot%\system32 value at the top of the list of environment variables.


  1. If you don't have the %SystemRoot%\system32 variable, click on "New" and add it.

%SystemRoot% usually is C:\Windows, so %SystemRoot%\system32 is typically the same as C:\Windows\system32.

  1. Select the variable and click "Move Up" until it is the first variable in the list.

move systemroot variable up

  1. Click on "Ok" to confirm the changes.

  2. Close your Command prompt application and then reopen it.

Note that you must restart your Command prompt shell for the changes to take effect.

You might also have to restart your PC, but that's not always necessary.

Now you should be able to use the ping command.

Here is an example that pings the destination google.com.

ping google.com

running ping command windows

If you want to ping the destination a specific number of times, use the /n parameter.

ping /n 10 google.com

The command pings google.com 10 times.

You can look at other examples of using ping in this section of the docs.

# 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.