7

Is there a cost of having too many folder paths in the folder variable?
I mean as you keep on adding paths in to your System Path Environment variable, Is it going to cause Powershell to load slightly slower than before?

If it is going to have a performance cost, what is the alternative to adding a ton of folder paths in a single PATH variable?

1
  • How many folders are you talking about? Hundreds or even more?
    – drew010
    Nov 26, 2011 at 18:39

1 Answer 1

1

Not sure why you are doing this in the first place.

For Powershell, there is no need to load up the PATH variable when you can use profiles and aliases. The performance cost is the prompt having to search each folder when it looks for commands.

Then there is a practicality cost. Path is a global variable. Why use it to solve something that is only used by Powershell and the console? A global solution to a local problem generally leads to unforseen consequences.

Another unintended consequence is if you mistype a command and the system ends up launching a file from outside your working directory. It is just a pain in the rear and also a security vulnerability.

Edit:

BTW, while the OS has a limit of 32,767 for the PATH variable, the Command Prompt has a much much shorter length, somewhere around 2,000. I don't know the exact numnber.

2
  • i think aliases is just what i wanted. I have also thought of having separate consoles for separate purposes. thereby, reducing the chance that i might end up launching a file outside the current directory
    – Prasanth
    Nov 26, 2011 at 19:24
  • Aliases and profiles are heavily underused by console users. Especially considering Powershell emulates all the other console commands.
    – surfasb
    Nov 27, 2011 at 3:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .