1

I have a simple script which does not work:

Param([string] $Input, [string] $Output)
Write-Host $Input
Write-Host $Output

The $Input parameter does not get printed:

PS> .\Get-Parameters.ps1 "First" "Second"

Second

If I rename $Input to $Joe the script works fine. $Input is not a reserved name.

What is going on? I am perplexed.

1
  • 1
    Did you read help about_Automatic_Variables? Commented Nov 5, 2012 at 14:18

2 Answers 2

2

PowerShell's $input is an automatic variable:

basically $input in an enumerator which provides access to the actual pipeline.

Reading about $input

Sign up to request clarification or add additional context in comments.

2 Comments

@emddudley The second link tell $Input is case-sensitive... really isn't it!!
1

$input in an enumerator which provides access to the pipeline you have.

reference here: $Input Gotchas

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.