PowerTip: Don’t Name a Variable $input

The Scripting Guys

Dr

Summary: Advice against using $input for a variable name.

Hey, Scripting Guy! Question Can I use a variable named $input to hold input from the Read-Host cmdlet?

Hey, Scripting Guy! Answer $input is an automatic variable that is used for script blocks in the middle of a pipeline.

As such, it would be a very poor choice. 

Call the variable something like $userInput if you wish; but please do not call it $input

The Scripting Guys
Dr Scripto

Follow Dr   

No Comments.