Search notes:

PowerShell: The automatic variable $HOME

$home is equivalent to $env:homeDrive$env:homePath and points to a user's home directory (for example C:\Users\username).
PS C:\> write-output $home`n$env:homeDrive$env:homePath
The home directory can be abbreviated with the tilde:
ls ~/*
cd ~

Changing value of $home

$home is read-only, its value cannot simply be changed by assigning a new value to it:
PS: C:\Users\rene> $home = 'c:\xyz'
Cannot overwrite variable HOME because it is read-only or constant.
…
It's possibly, however, to remove the variable with the -force option in the following command…
PS: C:\Users\rene> remove-variable -force home
PS: C:\Users\rene> $home = 'c:\xyz'
Note, that the tilde still is an abbreviation for the correct home directory:
PS: C:\Users\rene> ls ~

See also

$pwd stores the current working directory.
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/...', 1745343108, '3.15.239.31', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/language/variable/automatic/home(64): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78