0
Function Add ($x, $y)
{
    $Ans = $x + $y
    Write-Host “The Answer is $Ans”
}

is entered and saved as Add.ps1. When add 4 5 is executed, this is the result:

PS C:\Users\ddahlenburg\PowerShell> add 4 5

If the same code is entered in the command window the output is produced. What's up?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52

1 Answers1

0

Try calling the script as follows - (Assuming that the script is saved at "C:\Users\ddahlenburg\PowerShell")

PS C:\Users\ddahlenburg\PowerShell> ./Add.ps1 4 5

Amyako
  • 1