Is there a way to change PowerShell\'s default location?
How do you set PowerShell\'s default working directory?
With that, there seems to be some confusion on the "working directory" and PowerShell's "location". What most people here are doing, and saying to do is change PowerShell's "location". The "working directory" is actually different. Here is an article that explains it.
For those who don't want to read the article: Open PowerShell and use what others have said to do Set-Location "C:\some\directory"
. Notice that your "working directory" is still where your PowerShell was opened at. Either "~"
or "%SYSTEMROOT%\system32"
depending on if you ran as administrator or not. To check the working directory, use [Environment]::CurrentDirectory
.
Note: in the article the author says to check the "working directory" by using this command:
\[Environment\]::CurrentDirectory
I am not sure if this works with older PowerShell versions, but with PowerShell 5 (and later) you have to use [Environment]::CurrentDirectory
.