Inside the script, it seemed to me that there was a line today:
If ($?) {
I've never seen a $ dollar sign question mark sign? before and I canβt install through Google what it is intended for.
When I run it in a powershell window, it usually returns True, but sometimes returns False. My testing showed that it returns False when the code preceding it executes in an error (and in the context of the script, I saw that this might make sense), so this is probably an alternative way to handle TRY. CATCH script.
Example:
PS C:\Users\me> $? True PS C:\Users\me> $? True PS C:\Users\me> blah blah : The term 'blah' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + blah + ~~~~ + CategoryInfo : ObjectNotFound: (blah:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\me> $? False PS C:\Users\me> $? True
Can someone check me if this is the case, or if it serves some other purpose?
variables alias powershell
Mark wragg
source share