Emacs in Microsoft Windows FAQ
Where to download emacs for Windows?
Where is emacs's init file?
You have to create it.
On {Windows 10, Windows 8, Windows 7, Windows Vista} , by default, emacs looks at the following directory/file.
%HOMEPATH%\AppData\Roaming\.emacs
-
The
.emacs
file is old emacs convention. %HOMEPATH%\AppData\Roaming\.emacs.d\init.el
-
The
.emacs.d\init.el
is modern convention.
The init file may be byte-compiled, ending in .elc
. If a
fileName.elc
exist, emacs will load those instead.
If you have the environment variable named HOME
, then it's at:
%HOME%/.emacs
%HOME%/.emacs.d/init.el
HOME
should not be confused with HOMEPATH
.
HOMEPATH
is standard Microsoft Windows environment variable.HOME
is standard unix/linux environment variable. (doesn't exist in Windows by default.)
How to list environment variables?
- Launch PowerShell: press the ❖ Window key, then type powershell.
- in PowerShell prompt, type
Get-Command env:
How to Set Environment Variable?
In PowerShell, run this:
[Environment]::SetEnvironmentVariable("HOME", "c:/Users/xah/", "User")
[see PowerShell: View/Set Environment Variables]
Once you run it, you need to restart PowerShell for the variable to be available in current session, in case you want to start emacs from the PowerShell console.
Create a Environment Variable HOME
I highly recommend you create a environment variable named HOME. Because the HOME directory is heavily used by emacs from the unix convention.
Set the value of environment variable HOME to the same value as the environment variable HOMEPATH. For example:
c:/Users/xah/
Create a Emacs Init File
I recommend you create a emacs init file at
%HOME%/.emacs.d/init.el
How to find out if emacs init is loaded?
Put the following code in your init file:
(set-background-color "honeydew")
If emacs starts with honeydew background color, then it's loaded.
How to Start Emacs by Command Line?
Launch
PowerShell
, then type for example:
C:\Users\xah\Downloads\emacs-27.1-x86_64\bin\runemacs
How to start emacs in graphical user interface?
Go to emacs folder, then in the “bin” dir, then click on file runemacs.exe
How to start emacs with default dir at home dir?
Create a Windows shortcut, then set the “Start in” field.

To create a file shortcut:
- Hold Alt then drag that
runemacs.exe
icon to desktop. - In the newly created alias icon, right click to open file properties. Then, in the “Start in” field, enter your home directory.
- In the “Target” field, you can add emacs command line options. For example:
%home%\apps\emacs-24.1\bin\runemacs.exe -q --load=%home%\ErgoEmacs_dev\init.el --load=%home%\.emacs
. Here, i suppress loading init files by-q
, but load ErgoEmacs init files, then load my personal init files.
When i type Ctrl+Space, Windows switches me to other language input. What to do?
You can disable the Windows shortcut that switches you among input methods of different languages.
On Microsoft Windows 10:
Press ❖ Window, then type Advanced keyboard settings

Click on input language hot keys.

When i type Ctrl+Alt+s, HP System info came up. How to disable that?
How to run Bash shell or PowerShell inside emacs?
By default, the command named shell
will run “cmd.exe” inside emacs.
You can use eshell.
[see Emacs: eshell]
For powershell, install the powershell package. [see Emacs: Install Package with ELPA/MELPA]
Setting Environment Variable for Emacs Only
Emacs: Set Environment Variables within Emacs
Install Linux Tools
Some of emacs's features require unix utilities. The essential ones are these:
- Spell checking requires unix
ispell
- Checking difference between files require unix
diff
(called bydiff
) - Search string in files requires unix
grep
(called bygrep
and others.). - Listing files with particular suffix requires unix
find
(called byfind-dired
).
There are several ways to get linux tools for Microsoft Windows.
I recomment:
- Install chocolatey package manager. This lets you install many unix command line tools easily. See Xah Windows Setup
- Install Windows Subsystem for Linux (WSL)
For old school you may try Cygwin Installing Cygwin Tutorial
Alternatively, i recommend not rely on unix {find, grep, diff}, because they are 30 years old technology.
You can easily use PowerShell for unix find/grep/diff. See PowerShell vs Bash
For find/replace/grep needs within emacs, try Emacs: xah-find.el, Find Replace in Pure Elisp
If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial