Controlling the Forced Use of Windows Terminal: A ForceV2 Configuration Guide
Hello!
On recent Windows 10/11 systems, Windows Terminal launches automatically in place of the classic Command Prompt. The setting that controls this behavior is called "ForceV2". In this article, we take a close look at ForceV2 and how to configure it.
What is ForceV2?
ForceV2 is a value managed in the Windows registry that controls how the Command Prompt behaves
- Value 1 (default): the new Windows Terminal is used
- Value 0: the classic console (conhost.exe) is used
This setting lives at the following registry path
HKEY_CURRENT_USER\Console
Why would you change ForceV2?
Windows Terminal offers many excellent features, but there are cases where the classic Command Prompt is needed:
- Compatibility issues with certain legacy applications
- Debugging custom console applications
- Cases where certain console features do not work correctly in the new terminal
⚠️ Caution: with WSL, your existing batch files may stop working (there is a fix)
If you set ForceV2 to 0 (using the legacy console), a problem occurs when using WSL:
The problem
When you try to launch WSL from a batch file, the following error appears:
Unsupported console settings. In order to use this feature the legacy console must be disabled.
Error code: Wsl/Service/WSL_E_CONSOLEWhy this happens
- WSL depends on features of the new Windows Terminal/ConPTY
- In particular, it needs the following
- Improved Unicode support
- Modern terminal emulation
- Special console features for WSL
How to fix it
- Recommended approach: set ForceV2 to 1
reg add "HKEY_CURRENT_USER\Console" /v ForceV2 /t REG_DWORD /d 1 /f
- Alternative: launching WSL directly from Windows Terminal works fine (though for WSL users who want to script things in batch files, that rather defeats the purpose)
Recommended settings when using WSL
In environments that use WSL, we generally recommend keeping ForceV2 set to 1 (enabled). This gives you
- WSL working correctly
- Access to the latest terminal features
- Improved rendering of Unicode characters
- A better overall development experience
How to configure it
Method 1: Batch file (the easiest)
Create a batch file (.bat) with the following content.
To use the classic Command Prompt (disable ForceV2)
reg add "HKEY_CURRENT_USER\Console" /v ForceV2 /t REG_DWORD /d 0 /f
To use Windows Terminal (enable ForceV2)
reg add "HKEY_CURRENT_USER\Console" /v ForceV2 /t REG_DWORD /d 1 /f
Method 2: Configure it from a C# program
If you need more flexible control, doing it in C# works well too
using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Console"))
{
// Disable (0) or enable (1) ForceV2
key.SetValue("ForceV2", 0, RegistryValueKind.DWord);
}
Method 3: Set it manually in Registry Editor
- Press Windows key + R and type "regedit"
HKEY_CURRENT_USER\ConsoleNavigate to- Right-click and choose New → DWORD (32-bit) Value
- Name it "ForceV2"
- Set the value to 0 or 1
How to verify the setting
To confirm the setting has been applied correctly
- After changing the setting, close all Command Prompt windows
- Open a new Command Prompt
- You can tell from the window's title bar and appearance
Notes
- This is a per-user setting (HKEY_CURRENT_USER)
- Administrator privileges are not required
- The change applies to newly opened Command Prompt windows
- Windows that are already open are not affected
Summary
The ForceV2 setting is an important way to customize the Windows console environment, but WSL users are best off keeping it set to 1 (enabled).
When developing or debugging, switching between the classic Command Prompt and the new Windows Terminal as needed should make your work that much more efficient