Hello!
I’m an absolute newbie (two weeks into learning PS) and I’ve hit a speedbump with the following code:
$path = 'C:\Test'
$evalPath = Test-Path $path
if ($evalPath -eq $true) {
Write-Host "$path VERIFIED"
}
elseif ($evalPath -eq $false) {
Write-Host "$path NOT VERIFIED"
}
I’m getting this error in the console when I run the above:
elseif: The term 'elseif' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I’m unsure why I’m getting this error, as “if” is recognized. And I don’t think I have any open brackets (which seems to be a common cause to this issue in my research.) I’m using VS Code with PS v7.2.2
Thanks in advance!