Search notes:

PowerShell: The automatic variables $PSScriptRoot and $PSCommandPath

When evaluated within a script being executed, the automatic variable $psScriptRoot contains the absolute path of the directory where that script is located and $psCommandPath the absolute path of the script itself.
These variables evaluate to $null if they're not used within a script.
Because $PSScriptRoot evaluates to the module directory when used in a module script file (.psm1), it comes in handy to reference other resources that are related to a module.

See also

Determining the name and directory of a PowerShell script within the script itself.
Other automatic variables, especially $myInvocation.psScriptRoot, $myInvocation.psCommandPath, $myInvocation.mycommand.path and $myInvocation.myCommand.name.

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/...', 1745371383, '160.79.111.179', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/language/variable/automatic/psScriptRoot-psCommandPath(45): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78