My Portable C/C++ Coding Set Up with Notepad++

(or... How I got MinGW to work with Notepad++)

A few days ago, I decided to finally start learning C++. Until now I've only used a rather restricted version of C for robotics. However, I faced a problem: I never do all my work on a single PC. Sometimes I work in school, sometimes at home on my desktop, and sometimes at my grandparents' house on my laptop.
I usually use a portable version of Notepad++ for coding, but then again, most of my code is either web development or batch scripting - stuff that doesn't need a compiler.

Getting g++ to work with proper Notepad++ installations is easy, but this method doesn't work with portable versions since you cannot rely on environment variables. So I spent some time thinking about this issue, and came up with the following solution to integrate a portable version of Notepad++, my favorite editor, with MinGW:

  • Download Notepad++ Portable
  • Add the NppExec plugin from the Plugin Manager.
  • Download MinGW for Windows.
  • Extract the contents of the archive you downloaded.
  • Copy both to a portable drive.
  • Download this small utility I made: r-launch. This basically allows you to run MinGW commands from the Notepad++ directory.
  • Save r-launch.exe to the Notepad++Portable\App\Notepad++ folder of your portable installation.
  • Create a text file called r-launch.txt in the same directory and store the path of the MinGW installation in it. My MinGW installation was in G:\Coding\MinGW and my Notepad++ executable was in G:\Software\Notepad++Portable\App\Notepad++, so my text file read:
  • Open the NppExec windows in Notepad++ and type your MinGW commands like you normally would, only with r-launch.exe in front of them.
  • You're Done!

Here's the code I use in the NppExec window:

Saves and compiles in the same directory with the same name


Run in NppExec Console:
Runs the compiled version of the program.


Run in cmd:
Runs the compiled version of the program.


Compile and Run in NppExec Console:


Compile and Run in cmd:


These commands use g++, but you can use any of the utilities that comes with MinGW.


The source code of r-launch (licensed under the MIT License):

@echo off
Title r-launch: Rahul's MinGW Launcher
if [%1]==[] goto :help
goto :launch

echo r-launch: Rahul's MinGW Launcher for Notepad++
echo ----------------------------------------------
echo This file lets you add the MinGW utilities to
echo Notepad++.
echo Instructions:
echo 1. Save this executable to the same folder as
echo    the Notepad++.
echo 2. Save the path of the MinGW folder in a text
echo    file named 'r-launch.txt' in the same 
echo    folder as this executable.
echo 3. Run your commands with 'r-launch' in front
echo    of them from the NppExec plugin for
echo    Notepad++.
if %0 == "%~0" pause
goto :eof

set /p path=

if not exist r-launch.txt goto error1
if not exist notepad++.exe goto error2
if not exist %path% goto error3
if not exist %path%\set_distro_paths.bat goto error4

call %path%\set_distro_paths.bat
goto :eof

echo ERROR: 'r-launch.txt' doesn't exist in the same directory as this executable.
goto :eof
echo ERROR: 'notepad++.exe' doesn't exist in the same directory as this executable.
goto :eof
echo ERROR: The directory specified in r-launch.txt doesn't exist.
goto :eof
echo ERROR: 'set_distro_paths.bat' doesn't exist at in the directory specified in r-launch.txt.
goto :eof