Adding the current directory to Windows path permanently

后端 未结 2 1610
渐次进展
渐次进展 2020-11-27 23:39

I am trying to add the current directory (from a command-line) to Windows path permanently, but I am having serious problems implementing this.

My initial attempt was

2条回答
  •  天涯浪人
    2020-11-28 00:23

    Simple solution:

    The syntax of setx is slightly different than the syntax of set.

    With set, I would do:

    set PATH=%PATH%;%cd%
    

    With setx, I needed to do:

    setx PATH "%cd"
    

    The first argument specifies the name of the environment variable.

    The second argument specifies the value to add to this variable.

    The double-quotes are required for when the second argument contains spaces.

    This might also be the case with set, by the way.

提交回复
热议问题