Permanently altering a user's %PATH% environment variable via batch or Python

前端 未结 4 1682
梦毁少年i
梦毁少年i 2021-02-09 00:53

I\'ve been having difficulty with getting my users to set the PATH environment variable manually, I\'m looking for a way to do this automatically. A batch file would be prefera

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-09 01:36

    From this website:

    Using the add-on tool Setx.exe

    It is not part of the standard Windows XP setup but a command-line tool called setx.exe is included in the Windows XP Service Pack 2 Support Tools. This tool extends the set command so that permanent changes in the environment variables can be made. For example, to add a folder C:\New Folder to the path, the command would be

    setx path "%PATH%;C:\New Folder"
    

    This sounds like it'll work for what you're wanting to do.

提交回复
热议问题