Error: powershell else: The term ‘else’ is not recognized as the name of a cmdlet, function, script file, or operable program.
vscode gave me this error. When i researched this i found out it was caused because of the if else statement was on several lines. So After
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
If () { #something } else { #The bracket is on a different line then the "else" statment. This will break the script. } If (){ #something }else{ #this will NOT break } |
I have searched the web and tried several things. When i removed PSreadline module and installed the laters version (2.0.2) It was solved. I needed to remove the PSReadline directory in the module folder. The long story here on Stackoverflow.