How to change the PATH in Windows

7

I would like to know how I can change the PATH variable in the Windows environment.

I am linux user but I know that windows also allows the use of this environment variable to find its executables.

    
asked by anonymous 10.02.2014 / 13:16

6 answers

14

If you want to change PATH from the / command line inside your program by invoking the shell, the command is this:

set PATH=%PATH%;C:\minha\nova\pasta

The set is used to assign values to the environment variables; on the right side, %PATH% reads the value of the PATH variable and includes it in the list (so that it will have the old paths and the new path that you're adding). And the folders in Windows are separated by ; (and not by : as in * NIX). Note that this change is temporary (i.e. it is worth until you close the terminal / your program has finished executing).

If you intend to change this permanently variable (for all users or for a specific user), then look for the instructions for your specific version of Windows. If you want to do this programmatically , then you may need to tinker with Windows logs. See this question in SOEN for more details. One response indicates that it is possible to use the setx command instead of set to make the change permanent, I can not confirm this because I have never used this command before (I do not know from which version it is available):

setx PATH "%PATH%;C:\minha\nova\pasta"

setx PATH "%PATH%;C:\minha\nova\pasta" /m

(the first changes only to the current user, second to all users)

    
10.02.2014 / 13:32
6

Basically you have to access the environment variables, regardless of the Windows you are using.

Right click on the Computer and choose Properties:

Choose"Advanced System Settings"

Itwillopenthefollowingwindow:

Click environment variables, the following window will open:

Select Path and click edit

    
10.02.2014 / 13:26
5

You can change modifying the system registry on all versions of Windows, thus making permanent the change.

Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment and change the Path variable.

Learn how to change registry variables in windows .

    
10.02.2014 / 13:44
4

Follow these steps (Windows 7):

  

Iniciar button   Right mouse button on Computador
  On the left side of the screen that appears choose Definições avançadas do sistema   Choose Variáveis de ambiente

    
10.02.2014 / 13:23
4

Windows 8

    Arraste o ponteiro do Mouse até o canto inferior Direito da tela
    Clique no ícone Pesquisar e digite Painel de Controle
    Clique em -> Painel de Controle -> Sistema -> Avançado
    Clique em Variáveis de Ambiente, em Variáveis do Sistema, localize PATH e clique nele.
    Na janelas Editar, modifique PATH adicionando a localização da classe para o valor de PATH. Caso você não tenha o item PATH, será possível optar por adicionar uma nova variável e adicionar PATH como o nome e o local da classe como o valor.
    Feche a janela.

Windows 7

    Selecione Computador no menu Iniciar
    Escolha Propriedades do Sistema no menu de contexto
    Clique na guia Definições avançadas do sistema > Avançado
    Clique em Variáveis de Ambiente, em Variáveis do Sistema, localize PATH e clique nele.
    Na janelas Editar, modifique PATH adicionando a localização da classe para o valor de PATH. Caso você não tenha o item PATH, será possível optar por adicionar uma nova variável e adicionar PATH como o nome e o local da classe como o valor.

Windows XP

    Iniciar -> Painel de Controle -> Sistema -> Avançado
    Clique em Variáveis de Ambiente, em Variáveis do Sistema, localize PATH e clique nele.
    Na janelas Editar, modifique PATH adicionando a localização da classe para o valor de PATH. Caso você não tenha o item PATH, será possível optar por adicionar uma nova variável e adicionar PATH como o nome e o local da classe como o valor.
    Feche a janela.

Windows Vista

    Clique com o botão direito do mouse no ícone Meu computador
    Escolha Propriedades no menu de contexto
    Clique na guia Avançado (link Definições avançadas do sistema no Vista)
    Na janelas Editar, modifique PATH adicionando a localização da classe para o valor de PATH. Caso você não tenha o item PATH, será possível optar por adicionar uma nova variável e adicionar PATH como o nome e o local da classe como o valor.

Source: link

    
10.02.2014 / 13:31
2

Windows 8

  • Drag the mouse pointer (Mouse) to the bottom right of the screen
  • Click the Search icon and type Control Panel
  • Click - > Control Panel - > System - > Advanced
  • Click Environment Variables, under System Variables, locate PATH and click it.
  • In the Edit windows, modify PATH by adding the class location to the PATH value. If you do not have the PATH item, you can choose to add a new variable and add PATH as the name and location of the class as the value.
  • Close the window.
  • Windows 7

  • Select Computer from the Start menu
  • Relate the item
  • Choose System Properties from the context menu
  • Click the System Advanced Settings > Advanced
  • Click Environment Variables, under System Variables, locate PATH and click it.
  • In the Edit windows, modify PATH by adding the location of the class to the value of PATH . If you do not have the PATH item, you can choose to add a new variable and add PATH as the name and location of the class as the value.
  • Windows XP

  • Start - > Control Panel - > System - > Advanced
  • Click Environment Variables, under System Variables, locate PATH and click it.
  • In the Edit windows, modify PATH by adding the class location to the PATH value. If you do not have the PATH item, you can choose to add a new variable and add PATH as the name and location of the class as the value.
  • Close the window.
  • Windows Vista

  • Right-click the My Computer icon
  • Choose Properties from the context menu
  • Click the Advanced tab (Advanced System Settings link in Vista)
  • In the Edit windows, modify PATH by adding the class location to the PATH value. If you do not have the PATH item, you can choose to add a new variable and add PATH as the name and location of the class as the value.
  • 10.02.2014 / 13:32