Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Don’t Name a Variable $input

$
0
0

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


Viewing all articles
Browse latest Browse all 3333

Trending Articles