FIX: PowerShell V1.0 : Unrecognized token in source text.
When you try to print or access the Hashes in PowerShell v1.0 using @ operator, you’ll receive the error message detailed in this article below. In PowerShell v1.0, you instead need to use $ operator to refer to an hash variable. Code: $email = @{} $email.Add("From", "TestSender") $email.Add("To", "[email protected]") $email.Add("Subject", "Test mail from PowerShell 1.0") $email.Add("Body", “Hi There, Reply me back”) @email Error: PS C:Test> powershell C:Testtest-hases.ps1 Unrecognized token in source text. At C:packagingtest-hases.ps1:9 char:13 + write-host @ <<<< email PS C:Test> Fix: In PowerShell v1.0, a hash cannot be print using the @<hashname> operator. Instead, you can […]
Read more