This README explains how to set up a Windows development environment for C and C++ projects. It covers installing Visual Studio Build Tools, configuring nmake and cl, setting up Visual Studio Code to use the proper environment, customizing PowerShell with useful aliases, and creating a safe sandbox environment for testing programs in isolation. The instructions are suitable for software development and research scenarios where you want to avoid affecting your main system.
-
Download the Build Tools for Visual Studio:
- Go to the official Microsoft download page: https://visualstudio.microsoft.com/downloads/
- Scroll all the way down to “Tools for Visual Studio”.
- Click “Build Tools for Visual Studio” and download it.
-
Install only required components:
- Run the installer.
- Select the “desktop development with C++” workload.
- Ensure these components are checked:
- MSVC v142 or later (C++ build tools)
- Windows 10 SDK
- C++ CMake tools for Windows
- Windows SDK for Windows 10
- Click Install.
If Microsoft.VisualCpp.Redist.14 installation fails, follow the steps on: https://developercommunity.visualstudio.com/t/PackageId:MicrosoftVisualCppRedist14;/10902964
- Launch Developer Command Prompt:
- After installation, search for “x64 Native Tools Command Prompt for VS” in Start Menu.
- This sets all environment variables, including for
nmake.
-
Verify installation:
nmake /?
You should see the help menu for NMAKE.
- Open Notepad
- Paste the following (adjust path if needed):
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\VS2022_x64_Tools]
@="Open VS 2022 x64 Tools Here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\VS2022_x64_Tools\command]
@="\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\" && cmd.exe"- Save it as
vs-tools-here.reg - Double-click to add it to your registry.
Now right-click any folder background > “Open VS 2022 x64 Tools Here”.
To use nmake from within VS Code, launch it from the x64 Native Tools Command Prompt:
-
Open "x64 Native Tools Command Prompt for VS 2022"
-
Navigate to your project folder:
cd path\to\your_project -
Launch VS Code:
code .
The integrated terminal in VS Code will inherit the environment (cl, nmake, etc.).
Configure VS Code to run cmd.exe with the environment set by vcvars64.bat:
- Open Settings: go to File > Preferences > Settings (or
Ctrl + ,) - Search for Integrated Terminal
- Edit
settings.jsonto add a custom terminal profile:
"terminal.integrated.profiles.windows": {
"cmd with VS": {
"path": "C:\\Windows\\System32\\cmd.exe",
"args": [
"/k",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"
],
"icon": "terminal"
}
},
"terminal.integrated.defaultProfile.windows": "cmd with VS"You can now launch cmd with VS as a terminal profile inside VS Code.
nmakeuses cmd.exe syntax, not PowerShell.- Commands like
delandcopywork in Makefiles, but PowerShell commands likeRemove-Itemwill not.
- Open the PowerShell profile:
notepad $PROFILE- Add useful aliases as functions:
# Git shortcuts
function gst { git status }
function gph { git push } # 'gp' is already taken
function ga { git add $args }
function gcmsg { git commit -m $args }- Save and reload the profile:
. $PROFILEWhen developing or testing programs that should not run on your main system, it is recommended to use an isolated environment. Windows Sandbox provides a disposable virtual machine that resets every time it closes.
The repository includes two files in the windows-sandbox folder that demonstrate how to prepare such an environment:
WindowsSandboxConfigFile.wsbsetup-lang.ps1
These files show how to configure a sandbox, map a working folder, disable networking, and perform automated initialization steps.
- Windows version requirement: Windows 10 Pro, Enterprise, or Education (version 1903 or later) or Windows 11 Pro/Enterprise.
- Enable Windows Sandbox feature:
- Go to Control Panel > Programs > Turn Windows features on or off
- Check Windows Sandbox
- Click OK and reboot if required
- Start the sandbox:
- Double-click the
WindowsSandboxConfigFile.wsbfile included in the repository - This will launch Windows Sandbox with the configured environment
- The mapped folder and startup script will run automatically
- Double-click the
This file defines how the sandbox behaves on startup. It demonstrates how to:
- Map a host directory into the sandbox (example path:
C:\path\to\my\host-folder) - Disable networking for isolation
- Automatically run a PowerShell script when the sandbox launches
- Open Explorer and PowerShell inside the mapped folder for immediate testing
Paths can be adapted to any directory you use for testing.
The PowerShell script referenced by the .wsb file runs automatically when the sandbox starts. In this repository, it is used as an example of:
- Performing initial setup tasks
- Configuring system or user preferences inside the sandbox
- Writing a log file to the mapped folder
- Preparing a reproducible environment before testing
You can replace its content with any initialization logic needed for your own environment.



