How to set PATH on Windows through R “shell” command

前端 未结 3 1602
粉色の甜心
粉色の甜心 2021-02-06 08:57

I wish to add git to my PATH in Windows 7, through the \"shell\" command in R.

shell(\'set PATH=%PATH%;\"C:\\\\Program%20Files%20(x86)\\\\Git\\\\bin\"\', intern          


        
3条回答
  •  [愿得一人]
    2021-02-06 09:33

    When you run shell, a new process is created. In Windows, this will run CMD.EXE and pass the arguments given. Then this process exits.

    When you modify the environment variable, you are modifying in a subprocess of R and not in the R process itself. When the subprocess dies, so does its environment.

    You should set the path appropriately before you start R instead.

提交回复
热议问题