Windows

Keyboard Shortcuts1

You can press CTRL+SHIFT+WIN+B to reset graphics drivers.

You can press CTRL+SHIFT+ESC to open the Task Manager.

You can press ALT+Space to open the Context menu. If you press n next, it will minimize the active window.

You can press CTRL+I to open the System Settings pane.

Users and Groups

The hidden netplwiz utility helps you manage users and groups. You can use this utility by opening the Run dialog and typing netplwiz.

Changing Local Username

  1. Open the Run dialog and type netplwiz.
  2. Select the user, and click "Properties".
  3. Change the username.

Setting Up SSH

Add-WindowsCapability -Online -Name OpenSSH.Server*
Get-Service -Name *ssh*
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
Start-Service 'ssh-agent'
Set-Service -Name 'ssh-agent' -StartupType 'Automatic'
  1. Open up Search (WIN+S) and type "Optional features"
  2. Click "Add an optional feature"
  3. Search "SSH"
  4. Enable "OpenSSH Client" and "OpenSSH Server"

Registry Edits

Last Active Click

This is where I'm going to keep useful registry edits that I have discovered while working on the Windows operating system.

Add a DWORD titled LastActiveClick with a value of 1 to the following registry key to enable the "Last Active Click" feature.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
New-ItemProperty -Path "Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LastActiveClick" -Value 1 -PropertyType DWord -Force

Related: SuperUser Article "Shortcut to switch between same application windows"

Restore the Classic Context Menu

Run the following command, then restart the Explorer process.

reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

Run the following command, then restart the Explorer process.

Remove-Item -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace_41040327\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}" -Recurse

Remove "Git GUI Here" and "Git Bash Here" from the context menu

The following registry keys need to be removed:

HKEY_CLASSES_ROOT\Directory\shell\git_gui
HKEY_CLASSES_ROOT\Directory\shell\git_shell
HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_gui
HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_gui
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell

The script below removes these keys:

$regkeys = @(
    "Registry::HKEY_CLASSES_ROOT\Directory\shell\git_gui",
    "Registry::HKEY_CLASSES_ROOT\Directory\shell\git_shell",
    "Registry::HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_gui",
    "Registry::HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell",
    "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_gui",
    "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell"
)

foreach ($key in $regkeys) {
    if (Test-Path -Path $key) {
        Remove-Item -Path $key -Recurse
    }
}

Startup Apps

Press WIN+R and type shell:startup to open the startup folder, then copy and paste the shortcut to the app from the file location to the Startup folder.

Article: Add an app to run automatically at startup in Windows

You can confirm that the app will run at startup by visiting ms-settings:startupapps

View Keystrokes

Similar to Keycastr, Windows users can install Carnac

winget install carnac

However, for Carnac to install at launch, you'll have to add it as a startup app.

The fn Key

The fn key on the Apple Magic Keyboard won't work on Windows out of the box. An open source project WinAppleKey exists to create the mapping, but there are some tradeoffs. Windows requires WinAppleKey to use a self-signed certificate to allow it to run. For that reason, Windows will not allow the driver installation unless running in TESTSIGNING mode. Please be aware that permanently running Windows in TESTSIGNING mode leaves your system open to potential security risks. If your system is running a UEFI BIOS with Secure Boot enabled, you will need to disable Secure Boot in BIOS first before enabling TESTSIGNING mode.

To switch to TESTSIGNING mode issue the following command (in an Administrative command prompt) and then reboot your PC:

bcdedit.exe -set TESTSIGNING ON

Mac Precision Touchpad

The Magic Trackpad 2 feels great on macOS, but sluggish on Windows 11 by default. An open-source project mac-precision-touchpad provides drivers that make the trackpad feel more like macOS. At present, I am using release 3979

Download the Drivers-amd64-ReleaseMSSigned.zip file, unzip it, and find the .inf file, right click on it and click install.

Adjusting the Cursor Speed

Open the registry editor CTRL+R regedit and navigate to the following directory:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\PrecisionTouchPad\

Double click/tap on the CursorSpeed DWORD to modify it.

Click/tap on Decimal, type a number between 2 (slower) to 20 (faster) for the cursor speed you want, and click/tap on OK. (see screenshot below)

Adjusting the Scroll Speed

Open the registry editor CTRL+R regedit and navigate to the following directory:

Computer\HKEY_CURRENT_USER\Software\Microsoft\Wisp\Touch

Double click on the Friction DWORD to modify it. It is a hexidecimal value. Convert it to 0x10 or 16. The lower the value for Friction, the faster the scrolling speed. You may need to reboot the computer for the change to take effect.

AutoHotkey

Launch AutoHotkey Scripts at Startup

Navigate to the following directory, which contains the set of scripts that will launch at startup:

C:\Users\austin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Add a shortcut to the AutoHotkey script that you'd like to have run at startup to this directory.

Windows Terminal

Tip: You can open up Windows Terminal from the File Explorer by typing wt in the address bar.

File Explorer

When you want to view the "Properties" of a file, you don't need to right-click and select the Properties menu item. If you prefer exclusively using the keyboard, you can select the file and press Alt+Enter. That will also open the Properties of the selected item directly. Alternatively, you can hold Alt while double-clicking on the file. This will also make the Properties window appear.

You can also press Alt+Up to go to the parent directory of the current working directory.

Shift+F10 opens the contextual or “right click” menu for a file/folder. This can be very handy for speed especially if you know which option you want to select. Look for an underlined letter in each option to know which letter you can press for faster access.

Rebinding Caps Lock

Personally, I never use Caps Lock. You can run the following three commands in a PowerShell with Administrator privileges in order to cause Windows to treat the Caps Lock key as CTRL instead:

$hexified = "00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00".Split(',') | % { "0x$_"};
$kbLayout = 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout';
New-ItemProperty -Path $kbLayout -Name "Scancode Map" -PropertyType Binary -Value ([byte[]]$hexified);

Note: You will need to restart your computer after running these commands.

Tip: Press WIN+X + A to quickly open up a new Windows Terminal in Administrator mode.

Changing the SSH Login Shell

By default, logging into a machine running Windows via SSH won't greet you with PowerShell, but rather, Command Prompt, the default shell. Fortunately, you can change this. Note: You need to be running an elevated PowerShell session to do this.

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\PowerShell\7\pwsh.exe" -PropertyType String -Force

You can also set the shell to be Bash, as follows:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\bash.exe" -PropertyType String -Force

For more information, see OpenSSH Server configuration for Windows Server and Windows


Things I had tok do after resetting my Windows computer.

Linking the NeoVim configuration file to the correct location:

New-Item -Path C:\Users\austin\AppData\Local\nvim\init.vim -ItemType SymbolicLink -Value C:\Users\austin\Developer\dotfiles\nvim\init.vim

Linking the Espanso configuration file to the correct location:

Remove-Item -Recurse -Force C:\Users\austin\AppData\Roaming\espanso\;
New-Item -Path C:\Users\austin\AppData\Roaming\espanso\ -ItemType SymbolicLink -Value C:\Users\austin\Developer\dotfiles\espanso\

Linking the PowerShell profile to the correct location:

New-Item -Path C:\Users\austin\Documents\WindowsPowerShell\ -ItemType SymbolicLink -Value C:\Users\austin\Developer\dotfiles\pwsh\

Things I still need to do: