Emacs Init: Change Default Shell (PowerShell)

By Xah Lee. Date: . Last updated: .
explicit-shell-file-name
variable. A full path to the default shell started by the command shell

sample init to set it to PowerShell

;; on windows, make pwsh the default shell
(when (eq system-type 'windows-nt)
  (let ((xlist
         '(
          "~/AppData/Local/Microsoft/WindowsApps/pwsh.exe"
          "C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe"
          ))
        xfound)
    (setq xfound (seq-some (lambda (x) (if (file-exists-p x) x nil)) xlist))
    (when xfound (setq explicit-shell-file-name xfound))))

Shell in Emacs

Emacs on Microsoft Windows