Windows

Background

I’m a desktop Linux user who has used a Mac for a while because Linux doesn’t really work on laptops. Thinking that perhaps Linux ought to have caught up I bought a Lenovo Yoga and installed Arch on it. Arch can’t handle the screen resolution or the tablet mode and the battery only lasts 4 hours, so let’s try Windows 11.

Installation

It’s necessary to create a bootable USB stick. There is a download page with an ISO image, but that image is for optical disks. If you put it onto a USB stick the firmware will recognise it but the Windows bootloader won’t (it complains about missing drivers during the process). To create a USB installation you should go through the Windows image creating process to create the image. I used a virtual machine, although apparently it is possible to use woeusb too.

The installation creates four partitions:

  1. Small EFI partition
  2. 16G partition, presumably for hibernation (the machine has 16G RAM)
  3. The main partition
  4. Small recovery partition

Admin account

The installation process requires you to use a Microsoft account; this gives you an Admin account that is tied to this MS account. It’s possible to convert to a local account but the home path remains as an abbreviation of the MS account name. However, you can create a new local account then use that account to delete the MS one.

Encryption

Before doing much more it’s appropriate to encrypt the disk. The current way is enable bitlocker. For me this created an extra recovery partition on top of the one that the MS install created. So now there are five partitions.

Terminal

There is a terminal app that knows about several shells. Two pertinent ones are:

  1. cmd.exe, the original command prompt
  2. PowerShell. This is the one to use. The terminal has a profile for each one.

One thing to know about PowerShell is that it functions on aliases; things like ls are aliases to complicated looking calls to some API. You can add your own in a file:

~\Documents\WindowsPowerShell\profile.ps1

with the format

set-alias less more

Package manager

Windows 11 has a package manager; awesome, use it! The syntax is along the lines of

winget search thunderbird

and then

winget install thunderbird

and it knows about quite a lot of packages. The syntax can be wordy, but basically it works well. This gets you things like Zoom too. Also Visual Studio Code; I think I typed

winget install vscode

but I could be wrong.

WSL & Linux

Windows 11 comes with WSL: Windows Subsystem for Linux. This is a lightweight virtual machine that runs a standard Linux distribution with a slightly modified kernel. From powershell you can type

wsl --install

which lists the available distributions, then something like

wsl --install Debian

Thereafter you can type bash in powershell and Debian will appear. The terminal app also gains a configuration to run Debian directly from the terminal. The Windows filesystem is visible as /mnt/c and the Linux filesystem is in the file manager.

I’m told that you can then install more or less anything you want under Linux. However, for me this is missing the point; it’s Windows so let’s see what works native.

Git & SSH

VSCode is quite well integrated with Git, it’s not there though. However, SSH is. To start the OpenSSH agent, find the Services app, scroll to OpenSSH and right click Properties. Select Automatic (Delayed Start). The config is in ~/.ssh. After a restart you can then say ssh-add as under Linux.

For Git, run winget install git.git. This gets you a windows version of git. The gotcha is that it comes compiled with its own version of SSH. It’s necessary to force it to use the the “native” one by setting the environment variable GIT_SSH; this can be done on the command line:

setx GIT_SSH C:\Windows\System32\OpenSSH\ssh.exe

Now Git and SSH should work.

LaTeX

Many references suggest using texlive. However, I find that MikTeX is better:

winget install miktex

VSCode now works fine with LaTeX.

PDF viewer

The “native” viewer is Edge. However, it’s a bit heavy and it doesn’t automatically reload the document when it changes. Current solution is SumatraPDF:

winget install sumatrapdf

which seems to work fine with LaTeX, except for the ugly yellow logo.

Emacs

Generally Not Used Except by Middle Aged Computer Scientists; however, still very useful. Install with winget. By default it has no idea where your home directory is, but it understands HOME, so

setx HOME $env:USERPROFILE

It still doesn’t default to loading from there, but it understands ~, so not so painful. auctex works well with MikTeX.

Dev tools

For software development you can install Visual Studio and it’s enormous. For just command line things it’s possible to install just the build tools. For this, I think I did

winget install Microsoft.VisualStudio.2022.BuildTools

This gives you a graphical installer from which you can install just the C++ compiler. I’m still lost with this. For instance, Visual Studio includes cmake and ninja depending on how much of it you install. I have at least the cl.exe compiler and nmake, and this is added manually to the path:

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64

which seems stupidly long, but does appear to “work”. Right now nmake works with LaTeX, but I’m yet to get compilation up. This process adds another option to the terminal app: “Developer VS 2022” for both cmd and PowerShell. This in turn is just a shell with the dev tools on the path.