Как задать path windows 10

Для быстрого доступа к командам в командной строке без необходимости ввода полного пути к исполняемому файлу можно добавить путь к папке с этими исполняемыми файлами в переменную PATH в Windows, особенно это может быть полезным при работе с adb, pip и python, git, java и другими средствами разработки с отладки.

В этой пошаговой инструкции о том, как добавить нужный путь в системную переменную PATH в Windows 11, Windows 10 или другой версии системы: во всех актуальных версиях ОС действия будут одинаковыми, а сделать это можно как в графическом интерфейсе, так и в командной строке или PowerShell. Отдельная инструкция про переменные среды в целом: Переменные среды Windows 11 и Windows 10.

Добавление пути в PATH в Свойствах системы

Для возможности запуска команд простым обращением к исполняемому файлу без указания пути, чтобы это не вызывало ошибок вида «Не является внутренней или внешней командой, исполняемой программой или пакетным файлом», необходимо добавить путь к этому файлу в переменную среды PATH.

Шаги будут следующими:

  1. Нажмите клавиши Win+R на клавиатуре (в Windows 11 и Windows 10 можно нажать правой кнопкой мыши по кнопке Пуск и выбрать пункт «Выполнить»), введите sysdm.cpl в окно «Выполнить» и нажмите Enter.
  2. Перейдите на вкладку «Дополнительно» и нажмите кнопку «Переменные среды».
    Открыть настройки переменных среды Windows

  3. Вы увидите список переменных среды пользователя (вверху) и системных переменных (внизу). PATH присутствует в обоих расположениях.
    Переменная среды PATH пользователя и системная

  4. Если вы хотите добавить свой путь в PATH только для текущего пользователя, выберите «Path» в верхней части и нажмите «Изменить» (или дважды нажмите по переменной PATH в списке). Если для всех пользователей — то же самое в нижней части.
  5. Для добавления нового пути нажмите «Создать», а затем впишите новый путь, который требуется добавить в переменную PATH в новой строке. Вместо нажатия «Создать» можно дважды кликнуть по новой строке для ввода нового пути.
    Добавление папки в переменную PATH

  6. После ввода всех необходимых путей нажмите «Ок» — ваша папка или папки добавлены в переменную PATH.

Внимание: после добавления пути в переменную PATH потребуется перезапустить командную строку (если она была запущена в момент изменения), чтобы использовать команды без указания полного пути.

Как добавить путь в переменную PATH в командной строке и PowerShell

Вы можете добавить переменную PATH для текущей сессии в консоли: то есть она будет работать до следующего запуска командной строки. Для этого используйте команду:

set PATH=%PATH%;C:\ваш\путь

Есть возможность добавить путь в PATH с помощью командной строки и на постоянной основе (внимание: есть отзывы, что может повредить записи в переменной PATH, а сами изменения производятся для системной переменной PATH), команда будет следующей:

setx /M path "%path%;C:\ваш\путь"
Добавление в PATH в командной строке

Набор команд для добавления пути в переменную PATH пользователя с помощью PowerShell:

$PATH = [Environment]::GetEnvironmentVariable("PATH")
$my_path = "C:\ваш\путь"
[Environment]::SetEnvironmentVariable("PATH", "$PATH;$my_path", "User")

Если требуется добавить путь в системную переменную PATH для всех пользователей, последнюю команду изменяем на:

[Environment]::SetEnvironmentVariable("PATH", "$PATH;$my_path", "Machine")

Windows 10 supports a number of legacy features from older versions of the operating system. One of those legacy features is the environment variable. Environment variables offer a useful way to control the way Windows operates with an extremely small footprint in terms of memory usage.

For example, one common environment variable is called PATH, which is simply an ordered text string containing a list of directories that Windows should look in when an executable file is called. The PATH environment variable allows users to quickly launch programs without having to know where those programs live on the hard drive.

Setting environment variables is very useful and, fortunately, very simple. In this article, we’ll go over how to find and set your environment variables in Windows 10.

  1. Once logged in to Windows, right-click the Windows button in the lower-left corner of your screen and click System from the Power User Task Menu that’s displayed on the screen.
  2. Under the System menu, you need to click the Advanced System Settings.
    • If you can’t find Advanced System Settings there, type “advanced system settings” into the search box and hit return to bring it up.
  3. Once Advanced System Settings is open, click on the Advanced tab, then look on the bottom-right side for the Environment Variables.
    System Properties

  4. Next, to create a new environment variable, click New. You might need to make a System variable depending upon what you’re doing.

  5. A dialog box will pop up, allowing you to enter a new variable name and to set its initial value:
    • New adds a new environment variable.
    • Edit lets you edit whatever environment variable you have selected.
    • Delete lets you delete the selected environment variable.
  6. Save any changes that you make by clicking OK.

How to Find the PATH Variable in Windows 10

  1. Under the Environment Variables window, choose or highlight the PATH variable in the System Variables section shown in the window.

  2. After highlighting the PATH variable from System Variables, click the Edit button.
  3. You can add or modify the path lines with the directories you want your computer to look in for executable files.
    • You will find that each different directory is separated with a semicolon, for example: C:Program Files;C:Winnt;C:WinntSystem32
  4. There are other environment variables in the System Variables section that you can examine by clicking Edit.
  5. Likewise, there are different environment variables, such as PATH, HOME, USER PROFILE, HOME and APP DATA, TERM, PS1, MAIL, TEMP, and so on. These Windows environment variables are very useful and can be used in scripts as well as on the command line.
  6. Once finished, you can test your changes by opening a new PowerShell window and entering the following: $env:PATH

Frequently Asked Questions

Here is some more information about Environment Variables for you:

How Do I Find Environment Variables in Windows 10?

To find environment variables in Windows 10, you can follow the steps described above to find the environment variable information tucked away inside the system’s advanced settings.

Alternatively, if you just need to see what the variables are but don’t need to change them, you can simply open a command-line interface by hitting Ctrl +Esc and typing “cmd” in the command box, then type “set” in the command window. This prints out all the environment variables that are set on your system.

Why Can’t I Edit the Environment Variables?

There are several reasons that you may not be able to set these variables.

1. The first of your problems could be that you don’t have Admin rights. To set or edit this function, you must be the Administrator of the system.

2. If you are the Admin, yet the edit function is greyed out, try accessing the Environment Variables by accessing the Control Panel from the Start menu. Click on Advanced System Settings, then click Environment Variables.

Final Thoughts

Windows 10 environment variables make it incredibly easy to take control of your Windows device and make it run more efficiently. To find and set environment variables in Windows 10, follow the simple steps laid out in this article to get started.

Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.

Send To Someone

Missing Device

Different programs and processes require different environments to run. On a single machine, Windows needs to make sure that all programs and processes can access the environments they need.

To do this, Windows needs to know the kind of environment every program requires to work. Windows must store this information somewhere for easier retrieval. Environment variables make that possible.

Environment variables are, in short, data storing mechanisms.

Let’s dig a little deeper to see how environment variables work and how you can create, edit, and delete them effectively.

What Are Environment Variables in Windows 10?

Environment variables are dynamic variables that store data related to creating different environments for different programs and processes.

To understand them better, let us take the example of a program that needs to use a built-in Windows tool to run.

For the program to use the tool, the program needs to know the tool’s location to access it. The program also needs to find out if it has permission to use the tool or not. Similarly, there are things that a program needs to know before it can use the tool.

So, a program can access all of this information by asking Windows. Windows then looks up environment variables (EVs) for this data and creates an environment in which that program can run.

In other words, EVs store data that is accessible to every program and process running on the system across all users. The data these variables store helps the programs run in the environment they were designed for.

Some of the most important EVs on Windows include PATH, HOMEPATH, and USERNAME. All of these variables contain values that any user and process of the system can access at any time. For instance, the USERNAME environment variable contains the name of the current user. Windows can look up this variable whenever it needs to find out the name of the current user.

How to Set Environment Variables in Windows 10?

First things first, if you want to set system-wide EVs, you need to have administrative privileges. So, if you are not the admin, inform your system administrator and ask for their help.

Now that you have admin privileges:

  1. Type Advanced system settings in the Start menu search box and select the Best match.
  2. In the System Properties box, click on Environment Variables to open the Environment Variables panel.
Advanced system settings panel in Windows

The EVs panel lists two types of variables depending upon your need. If you want to change EVs for the current user only and don’t want the changes to reflect system-wide, you will change User variables.

On the contrary, if you want system-wide changes, you will change System variables.

Environment variables panel

Let’s say you’ve just installed Java and want to add the java path to the EVs. To do this:

  1. Click on New under the User/System variables. This will open up the New User Variable box.
  2. Enter JAVA_HOME in the Variable name field and browse to the directory where you’ve installed Java to populate the path in Variable value.
Adding a new environment variable

Pressing OK will add the JAVA_HOME variable to the PATH variable.

How to Edit Environment Variables

To edit different environment variables, select any variable from the list. Then, press Edit. This will open up the Edit environment variable panel. Here you can create, delete, and edit variables.

Environment variable Edit variable panel

From the list of variables, select the one that you want to modify and click on Edit. Afterward, you can change the variable value to anything you like.

You can also delete the variables in a similar fashion.

What Is the Windows PATH Variable and How Can I Change it?

In simple terms, the PATH variable is an address book of programs and commands on your computer. Whenever you have a new program on your computer that you want to run from the command line interface, you must specify its address in the PATH variable.

A thing to remember here, not all programs are in the PATH environment variable. Only the programs that are meant to be used from the command line interface appear in the PATH variable. So, programs intended to be used from a Graphical User Interface don’t have their addresses in the PATH variable.

The way the process works involves Windows looking up the address for a certain command. Whenever you issue a command on a command line, Windows first searches the current directory for the command. If the OS can’t find it in the current directory, it looks up the PATH variable to find the address.

To enter an address in the PATH variable, the process is the same as before. Open up the Environment Variable box, select the PATH variable, and click on Edit.

In the Edit box, you can add, remove, and edit directories.

One final thing to remember, the PATH variable is not the same for every user on a system. So different users can list different directories without changing the variable for every user. So, if you want a tool to be available for every user, you have to edit the PATH variable under the System Variables.

Environment Variables in Windows 10 Store Data that Programs Need to Work

Programs need data to work. To make sure that data is available efficiently, Windows stores this data in global variables that all programs can access. These global variables are Environment Variables.

You can add, edit, and remove Environment Variables inside the Advanced System Settings panel.

Furthermore, if you have more than one user on a machine, user Environment Variables will be different for each user. For instance, one user may have listed a command under the PATH variable that won’t be available for other users.

On the other hand, system EVs are available for all users. These variables require admin privileges to edit or delete.

In short, EVs are Windows’ way to store important data. So, be sure you know what you are doing before modifying them.

The Path environment variable feature in Windows is very important because it lets your computer know where to find the programs when you run them through Command Prompt. For example, if you add a folder path to the “Path” environment variable, you can run any program in that path by entering only its name (e.g. “name.exe”) instead of its whole address every time you want to run it.

This guide will show you how to add a folder to the Path environment variable in Windows 11 or 10. Doing this for a program you often run will save you a lot of hassle and time when executing commands that involve the program.

Add Folder to Path Environment Variable in Windows 11 10

What is the “Path” environment variable?

The Path environment variable is like a list inside your Windows operating system that helps your computer find and run programs directly from a command prompt or PowerShell without needing the full address of the program. It’s a bunch of folder addresses stuck together with semicolons (;). When you try to start a program, Windows looks through these folders in the order they’re listed to find the program’s executable file.

The big deal about the Path variable is it will truly save you a lot of time. Instead of typing the full path every time you want to run a program, you can just tell your computer to run it by typing only its name, and if the program’s folder is in the Path, Windows will know where to find it.

Related issue: Batch (.BAT) Files Not Running in Windows 11/10

Here’s what a Path environment variable look like:

C:\Windows\system32;C:\Windows;C:\Program Files\Java\jdk1.8.0_281\bin

In this example, there are three directories listed. If you run a command, Windows will check these directories in this order to find the program you’re trying to start. If it’s not in any of these, you’ll see an error message.

“[Program] is not recognized as an internal or external command” error

If you’re trying to run a program called “custom-command,” but its folder isn’t listed in the Path. When you try to start it, you might see an error saying:

'custom-command' is not recognized as an internal or external command, operable program or batch file.

is not recognized as an internal or external command Windows 11

This error means Windows can’t find the program in any of the Path directories. To fix this, you need to add the program’s folder to the Path, which we’ll talk about next, or simply type the full path to the program.

Useful tip: How to List Installed Programs in Windows 11

How to add a folder to the “Path” environment variable in Windows 11 or 10

Adding a folder to the Path can be done through a few methods – the system properties, CMD or PowerShell. Choose a method that you’re comfortable with.

Using System Properties

This method should be the easiest and most friendly for people who are not very into commands because it uses the graphical interface of the System Properties window to add or change the Path.

  1. Hit Windows + X and choose “System” from the menu that pops up.
  2. In the System window, click on “Advanced system settings” on the right.
    Windows 11 advanced system settings

  3. Go to the “Advanced” tab in the System Properties dialog and hit the “Environment Variables” button.
    View Environment Variables Windows 11

  4. Find the “Path” variable under “System variables,” select it, and press “Edit.” This opens the “Edit environment variable” window.
    Add Directory to Path Environment Variable Windows 11 10

  5. Here, you’ll see all the folders already in the Path. To add a new one, click “New” and type or paste its address. Tip: Use the “Copy as Path” option to get the folder path right, starting from the root (like C:\Users\YourUsername\custom-folder).
    Add Folder to Path Environment Variable in Windows 11 10

  6. Hit “OK” when you’re done. Your new folder is now part of the Path, and Windows will check it when looking for programs to run.

See also: Change File(s) Date & Timestamp via CMD or PowerShell

Using Command Prompt

In this method, you will use the Command Prompt to change the Path environment variable.

  1. Start a Command Prompt with admin rights by right-clicking on the Start button, choosing “Windows Terminal (Admin)”, and then picking “Command Prompt” from the list.
    Open Command Prompt from Windows Terminal

  2. Type this command, but use your own folder path instead of “YourFolderPath”:
    setx PATH "%PATH%;YourFolderPath"

    This adds your new folder path to the current Path variable. It’s important to keep the “%PATH%;” part to not lose the paths already there.
    To add the folder path in the system environment and prevents the system Path from being duplicated in the user Path, add the /M option like this:

    setx /M PATH "%PATH%;YourFolderPath"

    Add Folder to Path Environment Variable CMD

  3. Close the Command Prompt and open it again to see your changes. Your new folder should now be part of the Path environment variable.

Using PowerShell

This method involves PowerShell to update the Path environment variable.

  1. Open PowerShell with admin rights by right-clicking on the Start button and choosing “Windows Terminal (Admin)”.
  2. Type this command, swapping “YourFolderPath” with your folder path:
    [Environment]::SetEnvironmentVariable("Path",
    [Environment]::GetEnvironmentVariable("Path",
    [EnvironmentVariableTarget]::Machine) + ";YourFolderPath",
    [EnvironmentVariableTarget]::Machine)
    

    Add Folder to Path Environment Variable PowerShell

    This gets the current Path variable, adds your new folder path, and then updates the Path variable. The “;YourFolderPath” adds your new folder after the existing paths.

  3. Close PowerShell and open it again to check the changes. Your new folder should now be in the Path environment variable.

Note: If you need to write a multi-line command in PowerShell, press Shift + Enter to go to a new line without running the command. Press Enter to run it after you’ve typed all of it. This can be helpful for long commands or scripts.

Checking the changes

To make sure the folder is now in the Path environment variable, open a new Command Prompt window and type:

echo %PATH%

Look at the output and check if the folder path you added is there.

Check Path Environment Variable Windows 11 10

Some common issues

The below are some common problems you might encounter when adding a folder to the Path environment variable in Windows.

  • If CMD still gives you error after adding the path of a program you want to run, double-check for typos or mistakes in the folder path. It should be a full path without special characters.
  • Changes to the Path variable only affect new Command Prompt or PowerShell sessions. Restart them to see the changes.
  • If there’s still a problem, there might be a conflict with other software. Look through the Path variable for any outdated or duplicate paths and remove them.

Other common mistakes

It’s easy to make a small mistake that can cause big problems when you’re updating the Path variable.

  • Always back up the current state of the Path variable before making changes. This way, if something goes wrong, you can simply restore it to its original state.
  • Never delete the existing entries in the Path variable unless you are certain they are no longer needed. Removing important paths can stop other programs from running properly.

One last thing: Knowing Path variable priorities

The order of paths in the Path variable matters a lot because Windows checks them in sequence to find the executable files.

If two folders in the Path contain an executable with the same name, Windows will run the one in the folder that appears first in the Path order. You might want to place frequently accessed program directories higher up in the Path to speed up their launch times.

Download Article

A simple guide to adding directories to the system or user path variable

Download Article

  • Using Advanced System Settings
  • |

  • Using Command Prompt
  • |

  • Video
  • |

  • Warnings

The PATH environment variable specifies which directories the Windows command line looks for executable binaries. If you want to edit the PATH on Windows 11 or Windows 10, the process is easy, though not obvious at first. Read on to learn how to add, remove, and edit directories in the system PATH and user PATH environment variables on a Windows PC.

Editing the Path in Windows 11 & 10

1. Right-click the Start menu and select System.
2. Go to Advanced system settings > Environment Variables…
3. Select PATH under «System variables» or «User variables.»
4. Click Edit.
5. Click New.
6. Enter the directory path and click OK.

  1. Step 1 Right-click the Start menu and select System.

    Right-clicking the Start menu brings up the Power User menu, which has different options. You can also get to this menu using the keyboard shortcut Control + X.

  2. Step 2 Click Advanced system settings.

    You will see this option in the «Related links» section on the right panel. This opens the System Properties panel to the «Advanced» tab.

    Advertisement

  3. Step 3 Click Environment Variables….

    This button is near the bottom of the window, below the «Startup and Recovery» section.

  4. Step 4 Select Path under "System variables."

    Alternatively, if you only want to edit the path for your user account, not the entire system, select Path under «User variables» instead.

    • You may have to scroll down to find the Path variable.
  5. Step 5 Click the Edit button.

    This takes you to a screen where you can edit the PATH environment variable.

    Warning! DO NOT remove any variables unless you know what you’re doing.

  6. Step 6 Click New to add a new folder to the path.

    You’ll see this button at the top-right corner of the window.

    • If you want to edit an existing folder path, select it and click Edit instead. Then, modify the path as needed and click OK to save your changes.
    • To remove a directory from the PATH, select it, then click the Delete button.
  7. Step 7 Enter the folder you want to add to your path.

    Type the full path to the directory you’re adding. For example, if you’re adding FFmpeg to your path, you’ll usually want to add C:\ffmpeg\bin. For Java, it’ll usually be something like C:\Program Files\Java\jdk-23\bin.

  8. Step 8 Click OK, then OK again.

    Keep clicking OK until you’ve closed out of System Properties completely.

  9. Step 9 Open a new Command Prompt window and check the path.

    If you were working in an existing Command Prompt window, you’ll need to close it and open a new one to verify that you’ve added the path correctly. Once you’re there, type echo %PATH% and press Enter–you should now see the folder you added to your path in the list.

    • Alternatively, if you’re using PowerShell, you can echo the path using the command $env:Path -split ';'.
  10. Advertisement

  1. Step 1 Open Command Prompt as an administrator.

    If you want to add a directory to the system PATH in CMD, it’s super easy. To open Command Prompt as an admin, click the Start menu, type cmd, right-click Command Prompt, and select Run as administrator.

    • If you’re just editing the user PATH and not the system PATH, you don’t need to open Command Prompt as an administrator.
    • Important: Editing the PATH environment variable from the Command Prompt using the setx command is not typically recommended–setx merges the system and user PATHs and truncates the PATH to 1024 characters. If the directories in your PATH amount to more characters than that, you’ll likely break things. When possible, use Advanced System Settings instead.
    • If you’re on a school or work computer and don’t have permission to edit the PATH environment variable, ask your system administrator if there’s a utility installed to do this, such as pathman or pathed.
  2. Step 2 Add a folder to the user PATH.

    If you don’t need to make the change for all users of the system, the syntax is setx "%path%;C:\directory". Replace C:\directory with the full path of the folder you want to add to the path.

    • For example, if you’re adding JDK23 to your path, use setx "%path%;C:\Program Files\Java\jdk-23\bin".
    • This change will not take effect in the current Command Prompt window–you will need to open a new Command Prompt window to test your change.
  3. Step 3 Add a folder to the system PATH.

    To make it so the directory you are adding is added to the path for all users of the system, you’ll run the same command, but with the /M parameter. For example, setx /M "%path%;C:\Program Files\Java\jdk-23\bin" adds C:\Program Files\Java\jdk-23\bin to the PATH for all users of this system.

  4. Step 4 Open a new Command Prompt window and check the path.

    If you were working in an existing Command Prompt window, you’ll need to close it and open a new one to verify that you’ve added the path correctly. Once you’re there, type echo %PATH% and press Enter–you should now see the folder you added to your path in the list.

  5. Advertisement

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Video

Thanks for submitting a tip for review!

  • Changing the PATH environment variable incorrectly can cause your system to stop working correctly. Before changing PATH, you should have a basic understanding of what you’re doing.

Advertisement

About This Article

Thanks to all authors for creating a page that has been read 111,568 times.

Is this article up to date?

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Облегченная версия windows 10 для игр
  • Настройка подключения в windows vista
  • Как выставить браузер по умолчанию windows 11
  • Не удалось открыть страницу во внешнем браузере вероятно в windows не настроен браузер по умолчанию
  • Quality windows audio video experience что это за служба можно ли отключить