#GeekyJokes
Month: January 2021
Auto-update PowerShell and nag-free
If you are like me and get annoyed with the big PowerShell upgrade ‘nag’ ‘reminder’ (see screenshot below); instead of trying to figure out what to download and install the update, there is a simpler way to get the latest update and address the nag. 🙂
You can just run the code below in an elevated prompt to get the latest release of PowerShell – it is easy-peasy. 🙂
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
Changing Window Terminal’s default directory
If you are like me, and don’t really have your work saved in the “%USERPROFILE%” it gets annoying after a time, to keep changing the directory.
If there is one specific folder that you prefer, it is an easy configuration change in the profile setting – add a setting called “startingDirectory” and point it to the path you want.
For example, I have a root folder called “src” where most of the code I am working on sits, and that’s where I wanted to default the terminal to.
To get to the profile, you can either use the shortcut CTRL+, or from the dropdown in the title bar, click settings (see below). This will open the settings.json in your default editor.
In my case, I wanted the starting directory for all the shells, so I put it under “defaults” – you can choose different options for different shells, and then would have this in the appropriate shell’s settings and not the default block of course.
Below is what this looks like for me pointing this to “c:\src”. Also note, the escape characters need to be formatted properly to parse.
"defaults":
{
// Put settings here that you want to apply to all profiles.
"fontFace": "CaskaydiaCove NF",
"startingDirectory": "c:\\src",
},
Once you save the file, it should automatically reload the terminal. And if the json didn’t parse – because of a typo or a syntax error then you would see an error similar to the one shown below.
In this example, I set the starting folder as “c:\src”; instead of “c:\\src”.