Set system path windows

How to set the path and environment variables in Windows

Setting the path and environment variables will differ depending on the version of Windows you have on your computer. Choose a link below for your version of Windows.

Administrator privileges are usually required to modify the path and environment variables.

Setting the path and variables in Windows 10

  1. From the desktop, right-click the very bottom-left corner of the screen to get the Power User Task Menu.
  2. From the Power User Task Menu, click System.
  3. In the Settings window, scroll down to the Related settings section and click the System info link.
  4. In the System window, click the Advanced system settings link in the left navigation pane.
  5. In the System Properties window, click the Advanced tab, then click the Environment Variablesbutton near the bottom of that tab.
  6. In the Environment Variables window (pictured below), highlight the Path variable in the System variables section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon, as shown below.

You can edit other environment variables by highlighting the variable in the System variables section and clicking Edit. If you need to create a new environment variable, click New and enter the variable name and variable value.

To view and set the path in the Windows command line, use the path command.

Setting the path and variables in Windows 8

  1. From the desktop, right-click the very bottom-left corner of the screen to get the Power User Task Menu.
  2. From the Power User Task Menu, click System.
  3. Click the Advanced System Settings link in the left column.
  4. In the System Properties window, click the Advanced tab, then click the Environment Variablesbutton near the bottom of that tab.
  5. In the Environment Variables window (pictured below), highlight the Path variable in the System variables section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon, as shown below.

You can edit other environment variables by highlighting the variable in the System variables section and clicking Edit. If you need to create a new environment variable, click New and enter the variable name and variable value.

To view and set the path in the Windows command line, use the path command.

Setting the path and variables in Windows Vista and Windows 7

  1. From the desktop, right-click the Computer icon and select Properties. If you don’t have a Computer icon on your desktop, click Start, right-click the Computer option in the Start menu, and select Properties.
  2. Click the Advanced System Settings link in the left column.
  3. In the System Properties window, click the Advanced tab, then click the Environment Variablesbutton near the bottom of that tab.
  4. In the Environment Variables window (pictured below), highlight the Path variable in the System variables section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon, as shown below.
Читайте также:  Как удалить dr web agent с компьютера windows

You can edit other environment variables by highlighting the variable in the System variables section and clicking Edit. If you need to create a new environment variable, click New and enter the Variable name and Variable value.

To view and set the path in the Windows command line, use the path command.

Setting the path and variables in Windows 2000 and Windows XP

The path is now managed by Windows 2000 and Windows XP and not the autoexec.bat or autoexec.nt files, as was done with earlier versions of Windows. To change the system environment variables, follow the steps below.

  1. From the desktop, right-click My Computer and click Properties. If you don’t have a My Computer icon on your desktop, click Start, right-click the My Computer option in the Start menu, and select Properties.
  2. In the System Propertieswindow, click the Advancedtab.
  3. In the Advanced section, click the Environment Variablesbutton.
  4. In the Environment Variables window (as shown below), highlight the Path variable in the System Variable section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon, as shown below.

You can edit other environment variables by highlighting the variable in the System variables section and clicking Edit. If you need to create a new environment variable, click New and enter the Variable name and Variable value.

To view and set the path in the Windows command line, use the path command.

What is the default Windows %PATH%?

The path is based on programs installed on the computer, so there is no «default path.» However, the Windows minimum path is often the path below.

Keep in mind that as you install programs, the path is updated with the paths for the newly installed programs. So, if you have erased your path after installing other programs, those programs may be affected.

Setting path in the MS-DOS and Windows command line

To view and set the path in MS-DOS and in the Windows command line, use the path command.

Set path from command line

Users can run an executable from windows command prompt either by giving the absolute path of the file or just by the executable file name. In the latter case, Windows searches for the executable in a list of folders which is configured in environment variables. These environment variables are as below.

1. System path
2. User path

The values of these variables can be checked in system properties( Run sysdm.cpl from Run or computer properties). Initially user specific path environment variable will be empty. Users can add paths of the directories having executables to this variable. Administrators can modify the system path environment variable also.

How to set path from command line?

In Vista, Windows 7 and Windows 8 we can set path from command line using ‘setx’ command.

For example, to add c:\dir1\dir2 to the path variable, we can run the below command.

Alternative way is to use Windows resource kit tools ‘pathman.exe‘. Using this command we can even remove a directory from path variable. See download windows resource kit tools. This works for Windows 7 also.

Add directory to system path environment variable:

Open administrator command prompt
Run the below command

Remove path from system path environment variable:
Run the below command from elevated command prompt

Читайте также:  Windows media player как поставить обложку

Setting user path environment variable

For user environment varlables, admin privileges are not required. We can run the below command to add a directory to user path environment variable.

To remove a directory from user path, you can run the below command.

Default option is not allowed more than ‘2’ time(s)

You get this error if you have not enclosed ‘path’ in double quotes. See the below example for setting the path of firefox.

Now if you move %path% to be in the double quotes

Could a context entry be created for folders, perhaps an extended one… to add to path?

what about a multi-verb option, like copy as path?

hi, when i use setx at an administrator command line, it creates a USER variable, NOT the SYSTEM variable. What am i doing wrong? How do i change the SYSTEM path at command prompt? -thx

Johny Why
Answer: Try add the parameter /M

Hi, is there a way I can add an extra variable instead on deleting the currently one and put a new Variable on the Path.

I used the command setx /M “c:\Options”, and what it does is delete the current one and then puts that one there, all I want is to add the new variable to the current one. -thx

Nuno, pathman described above does exactly that. You can download the resource tools kit and get it.

setx path “%path%;C:\yourFolder”

To set path for java & javac, can I add the paths to PATH or do I need to create the environment variable JAVA_HOME. I don’t have this defined, but windows does not seem to be able to find java binaries on my system.

You can directly add the folder to PATH. No need to define JAVA_HOME. However, adding JAVA_HOME separately avoids cluttering and helps to easily understand what is added.

hello, can someone plz explain this result? After setting path, it did not change. This was run from an Administrator command-line:

C:\Windows\system32>setx path “C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;D:\Program Files (x86)\Microsoft VS Code\bin”

SUCCESS: Specified value was saved.

C:\Windows\system32>path
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;D:\Program Files (x86)\Microsoft VS Code\bin;D:\Program Files (x86)\metapad36;D:\Program Files (x86)\metapad36″ /M

Why won’t this work?

SET EPO = D:\Program Files (x86)\McAfee\ePolicy Orchestrator
PATH = %PATH%;%EPO%\jre\bin;%EPO%\apache2\bin

In windows 10 set path %path%; not working. it’s work like :
setx “%path%;C:\Program Files\CodeBlocks\MinGW\bin”

By unfortunately I deleted my system default path. How could I able to find my system path?

Unfortunately I deleted several files with unremembered path names. This article was useful

The following used to work for me when I am in MSDOS environment. Lately I get error messages such as INCLUDE not found. Why is this so?

Used to work
SET PLL =c:\CL5\PLL
SET PLT =c:\CL5\PLL
SET INCLUDE =c:\CL5\INCLUDE
SET PRG =c:\IMS\PRG
SET LIB =c:\CL5\LIB
SET OBJ =c:\CL5\OBJ
PATH =c:\IMS\EXE;\CL5\BIN;\CL5\NG;\CL5\PLL

pathman is one of many tools of the Windows Server 2003 Resource Kit Tools

Note: The Windows Server 2003 Resource Kit Tools are not supported on 64-bit platforms.

Huh.
When I did that on Windows 10 v1903, using setx, it replaced the USER scope paths with the SYSTEM scope paths.
Now I’m not sure what was in the old user path.
So, uh… Be careful out there.
And if anyone has a solution how to avoid that, please let me know
Thanks

Как изменить системную переменную path в Windows 7

Те, кто хоть раз пользовался утилитами командной строки, знают, что намного удобней набирать команду сразу, не используя при этом путь к этой утилите, и даже не переходя в нужный каталог, поэтому сегодня поговорим о системной переменной path в Windows, узнаем, для чего она нужна, и как ее можно изменить.

Читайте также:  Windows media playback что это

Сегодня мы не будем разговаривать о том, что такое командная строка и какие стандартные утилиты командной строки есть в Windows, так как об этом мы уже разговаривали в материале Основы командной строки Windows.

Для чего нужна системная переменная path

Системная переменная path нужна нам для того, чтобы мы могли добавлять свои утилиты в командную строку CMD.exe, а если говорить конкретней, то добавлять каталоги, т.е. пути к этим каталогам для того, что ОС могла определить по названию утилиты, где она расположена, и запустить ее.

Если говорить на примере, то допустим, Вы открываете командную строку, набираете команду ipconfig (служит для конфигурирования сетевых интерфейсов) и в момент запуска командная строка не знает, где располагается данная утилита, поэтому она начинает ее искать. Сначала в текущем каталоге, затем в системных каталогах, которые как раз, и указаны в системной переменной path. Другими словами, если Вы написали свою консольную программу и хотите ее запустить так же, как ipconfig, то у Вас это не получиться, так как ОС не знает, где же лежит сама программа. Поэтому нам нужно переходить в каталог с программой или писать полный путь к исполняемому файлу, для того чтобы запустить свою утилиту. Поэтому, если Вы часто пользуетесь какой-нибудь консольной программой, которой нет, в стандартной сборке Windows и не хотите копировать ее в системные каталоги, то лучше всего будет создать свой каталог и добавить его в системную переменную path.

Пример

Допустим, мы написали консольную программу, для примера у нас это будет простой bat файл со следующей простой командой:

Примечание! Если Вы хотите, чтобы в командной строке выводилась кириллица, то сохраните бат файл с кодировкой OEM 866, это можно сделать с помощью текстового редактора Notepad++.

Сохраним с названием privet.bat на диске C в каталоге test.

Теперь мы запускаем командную строку (ОС Windows 7) «Пуск -> Выполнить -> cmd».

И сразу попробуем запустить нашу утилиту, и посмотрим, что у нас из этого выйдет:

Как видите, командная строка не знает что это за программа. Мы, конечно, можем написать по-другому, например:

Т.е. с указанием полного пути к утилите, то тогда она конечно запустится. Или также можно перейти в каталог test и уже от туда запустить утилиту, например:

В данном случае программа тоже запустится. Но согласитесь, что это все лишние движения, тем более, если мы собираемся использовать эту программу достаточно часто. Поэтому давайте изменим системную переменную path.

Примечание! Если Вам не нравится фон или цвет шрифта командной строки, то Вы легко можете изменить его, а как мы с Вами разговаривали в статье Настройка внешнего вида командной строки Windows.

Изменяем системную переменную path в Windows 7

Для этого открываем «Панель управления -> Система -> Дополнительные параметры системы».

Затем выбираем «Переменные среды».

После у Вас откроется окно «Переменные среды» и Вы в нижней части окна в списке «Системных переменных» ищите переменную path и жмете «Изменить».

В итоге у Вас откроется небольшое окошко «Изменение системной переменной», где Вы в поле «Значение переменной» дописываете в конце через точку запятой, путь к каталогу, в котором Вы будете хранить свои консольные утилиты. Например, я указал C:\test. После ввода жмем «ОК».

А теперь давайте проверим. Будем делать в точности, как и в первый раз, т.е. открываем командную строку и сразу пишем privet.bat и смотрим

Как видите, на этот раз у нас все заработало, даже без указания полного пути.

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

Я думаю достаточно, если есть вопросы, задавайте в комментариях. Удачи!

Оцените статью