Search notes:

$?

$? is a boolean ($true or $false) that contains the status of the last executed command.
$? can be set by calling Cmdlet.WriteError() or Cmdlet.ThrowTerminatingError().
Because a command is required to evaluate the value of $?, its value must be checked right after executing a command:
PS C:\Users\Rene> no-such-command
no-such-command: The term 'no-such-command' is not recognized as a name of a cmdlet, function, script file, or executable program …

PS C:\Users\Rene> $?
False

PS C:\Users\Rene> $?
True

See also

In contrast to $?, $lastExitCode stores the exit code of the last native command or script that was run.
Pipeline chain operators
Other automatic variables

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1745370749, '160.79.109.8', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/language/variable/automatic/question-mark(56): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78