How do you avoid over-populating the PATH Environment Variable in Windows?

前端 未结 12 1054
慢半拍i
慢半拍i 2020-11-30 16:26

I would like to know what are the approaches that you use to manage the executables in your system. For example I have almost everything accessible through the command line,

12条回答
  •  感情败类
    2020-11-30 17:18

    I generally don't have to worry about this (I haven't run into a path size limit - I don't even know what that is on modern Windows systems), but here's what I might do to avoid putting a program's directory in the path:

    • most command line utilities get thrown into a c:\util directory that's on the path
    • otherwise, I'll add a simple cmd/batch file to the c:\util directory that looks something like:

      @"c:\program files\whereever\foo.exe" %*
      

    which essentially creates an alias for the command. It's not necessarily perfect. Some programs really insist on being in the path (that's pretty rare nowadays), and other programs that try to invoke it might not find it properly. But for most uses it works well.

    But generally, I haven't had to worry about avoiding adding directories to the path.

提交回复
热议问题