Emacs in Microsoft Windows FAQ

By Xah Lee. Date: . Last updated: .

Where is emacs's init file?

You have to create it.

Emacs looks for specific directory for it.

By default, emacs looks at the following directories.

On Windows 10, Windows 8, Windows 7, Windows Vista:

The init file may be byte-compiled, ending in “.elc”. If a .emacs.elc or .emacs.d\init.elc file exist, emacs will load those instead.

If you have the environment variable named “HOME”, then it's at:

“HOME” should not be confused with “HOMEPATH”.

(info "(emacs) Find Init")

How to list environment variables?

in powershell prompt, type gci env:

in cmd.exe prompt, type set

To launch powershell terminal or cmd.exe, press the ❖Window key, then type their name.

[see Windows Environment Variables Tutorial]

How to find out if emacs init is loaded?

Put the following code in your init file:

(set-background-color "honeydew")

Where to download a ready-to-use emacs for Windows?

Download Emacs for Windows, Mac, Linux

How to start emacs?

For Windows users, after download, unzip it. Go to the folder, in the “bin” dir, then click on file runemacs.exe to launch.

To run emacs inside Windows Console, start like this:

C:\Users\joe\apps\emacs-24.1\bin\emacs.exe --no-window-system

How to start emacs with default dir at home dir?

Create a Windows shortcut, then set the “Start in” field.

Windows 7 GNU emacs shortcut properties 2012-06-15
GNU emacs shortcut properties, in Windows 7.

To create a file shortcut:

  1. Hold Alt then drag that runemacs.exe icon to desktop.
  2. In the newly created alias icon, right click to open file properties. Then, in the “Start in” field, enter %home%.
  3. In the “Target” field, you can add your own init files. For example, here's mine: %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:

  1. go to Control Panel
  2. Under icon “Clock, Language, and Region”, click link “change input methods”
  3. Click “Advanced settings” on the left panel.
  4. Change language bar hot keys.

Here's the exact instruction for Windows Vista.

  1. Go to 〖Start ▸ Control Panel〗.
  2. Choose Classic View on the left.
  3. Double click on the “Regional and Language Options” icon, then go to “Keyboards and Languages” tab, click on “Change Keyboards…”.
  4. Then, go to “Advanced Key Settings” tab, then, it should list Key sequences on the right column.
  5. Select a input choice that has shortcut key, then click the button “Change Key Sequence”.

When i type Ctrl+Alt+s, HP System info came up. How to disable that?

Disable Ctrl+Alt+S Shortcut for HP Support Information, PC Doctor

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]

Where to get language modes for Visual Basic, “cmd.exe”, PowerShell?

Search MELPA. See Emacs: Install Package with ELPA/MELPA.

There are several packages for cmd.exe batch file, written by different people. You may want to try them in the order listed here:

See also: How to Install Emacs Package Manually.

Environment Variables

Two environment variable important to emacs are HOME and PATH.

Note: by default Windows 7 and Windows Vista, Windows 10, they have HOMEPATH, but not HOME.

HOMEPATH is Microsoft Windows's environment variable. HOME is unix's. Both are meant to be the full path of home directory.

Setting Your Home Dir

You should set a HOME env var. Here's how you do it in cmd.exe:

REM example of setting HOME env var
setx HOME "C:\Users\joe"

If you are running emacs within Cygwin, then the init file will be at ~/.

See: Windows Environment Variables Basic Tutorial.

Setting Environment Variable for Emacs Only

Emacs: Set Environment Variables within Emacs

Install Linux Tools

Some of emacs's features require unix utilities. For example:

If you came from a unix background, you may want to install unix shell and utilities such as {diff, find, grep, …}.

There are several ways to get linux tools.

I recomment:

Windows Subsystem for Linux (WSL) at https://docs.microsoft.com/en-us/windows/wsl/about

For old school you may try Cygwin Installing Cygwin Tutorial

If you have a question, put $5 at patreon and message me.
Or Buy Xah Emacs Tutorial
Or buy JavaScript in Depth

Emacs Tutorial

Emacs Init

Emacs Keys


ELisp Examples

ELisp Write Major Mode

Emacs Tutorial

Quick Start

Manage Windows



Find Replace




Rectangle Edit

Line Wrap


View Doc

Working with Brackets

Power Editing

Org Mode


Emacs Efficiency