Categories
Customization

Multi-version environment on Windows

Well many times this happens that we want to work with the command prompt. Sometimes we wanna work with many CLI (command line interface). We usually SET the %PATH% variable of system or specific user for this. Things get really worse when we wanna work with more them one version of same Application/Compiler/System. We can’t set the variable as all have similar directory structure and almost same binary/executable names.

Working with the command prompt on Windows is messy. Working with multiple versions of a language or compiler on Windows is extremely challenging and frustrating.

If you develop with Python, Ruby, Java, or any language where you need different versions for different projects, you know the pain. You might need Python 2.4 for one project, Python 2.5 for another, and want to try out the upcoming Python 2.6 or even the new Python 3.0. Switching between them shouldn't require system-wide configuration changes every time.

The Problem

The typical approach is to modify the Windows %PATH% environment variable, but this creates several problems:

  • Global changes affect all applications – Changing the system PATH affects every program
  • No easy version switching – You have to manually edit environment variables each time
  • Conflicts between versions – Multiple versions installed can interfere with each other
  • Risk of breaking existing projects – One change can break another project's dependencies

Possible Workarounds

Let's look at the common approaches and their drawbacks:

1. Set all paths and rename binaries

Add all versions to PATH and rename executables (e.g., python24.exe, python25.exe, python26.exe).

Problems:

  • You have to remember all the names or maintain a naming convention
  • Third-party tools may not find the right version
  • Still creates conflicts with library paths
  • Verdict: Not practical for serious development

2. Create separate user accounts

Create Windows user accounts for each environment, with different PATH settings per user.

Problems:

  • Switching versions means logging out and logging in as a different user
  • File permissions and access issues
  • Duplicated configuration across users
  • Verdict: Far too cumbersome for daily work

3. Use customized command prompts (Recommended)

Create custom shortcuts that launch command prompts with environment-specific PATH settings.

Benefits:

  • Each shortcut has its own isolated environment
  • Fast switching – just launch a different shortcut
  • No global system changes needed
  • Multiple prompts can run simultaneously
  • Verdict: Elegant and developer-friendly!

How to Create Custom Command Prompts

Here's the complete step-by-step process:

Step 1: Create Configuration Batch Files

Create batch files that configure the environment for each version. Use the naming convention: SYSTEM-VERSION-config.bat

Example: python-2.5-config.bat

@echo off
REM Python 2.5 Environment Configuration

REM Set Python 2.5 paths
SET PYTHON_HOME=C:\Python25
SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\Scripts;%PATH%

REM Set a custom prompt to identify this environment
PROMPT [Python 2.5] $P$G

REM Optional: Set window title
TITLE Python 2.5 Environment

REM Display environment info
echo ========================================
echo  Python 2.5 Development Environment
echo ========================================
echo.
python --version
echo.

Example: python-2.6-config.bat

@echo off
REM Python 2.6 Environment Configuration

REM Set Python 2.6 paths
SET PYTHON_HOME=C:\Python26
SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\Scripts;%PATH%

REM Set a custom prompt to identify this environment
PROMPT [Python 2.6] $P$G

REM Optional: Set window title
TITLE Python 2.6 Environment

REM Display environment info
echo ========================================
echo  Python 2.6 Development Environment
echo ========================================
echo.
python --version
echo.

Example: ruby-1.8-config.bat

@echo off
REM Ruby 1.8 Environment Configuration

REM Set Ruby 1.8 paths
SET RUBY_HOME=C:\Ruby\ruby-1.8.7
SET PATH=%RUBY_HOME%\bin;%PATH%

REM Set a custom prompt
PROMPT [Ruby 1.8] $P$G

REM Optional: Set window title
TITLE Ruby 1.8 Environment

REM Display environment info
echo ========================================
echo  Ruby 1.8 Development Environment
echo ========================================
echo.
ruby --version
echo.

Tip: Store all these configuration files in a dedicated folder like C:\config-files\ and set it as a hidden folder to keep your system organized.

Step 2: Create a Shortcut

Now create a Windows shortcut that uses this configuration file.

Right-click on your desktop or in any folder and select File → New → Shortcut.

Create new shortcut

Step 3: Configure the Shortcut Target

In the shortcut wizard, enter the following command in the location field:

%COMSPEC% /K "C:\config-files\python-2.5-config.bat"

Important: Replace the path with the actual location of your configuration file.

  • %COMSPEC% – Windows environment variable that points to cmd.exe
  • /K – Keeps the command prompt window open after running the batch file
  • The path in quotes is your configuration batch file
Creating shortcut

Alternative command options:

  • Use /K to keep the window open (recommended for development)
  • Use /C to run the command and close (for one-off tasks)

Step 4: Name Your Shortcut

Give the shortcut a descriptive name like "Python 2.5 Environment" or "Ruby 1.8 Console".

Rename shortcut to a proper name

Click Finish to create the shortcut.

Step 5: Customize the Shortcut Appearance (Optional)

Right-click on the newly created shortcut and select Properties to customize its appearance.

Command prompt shortcut
Shortcut properties

Font Settings

You can customize the font, size, and style for better readability.

Shortcut properties - Font

Recommendations:

  • Use "Lucida Console" or "Consolas" for better readability
  • Font size 12 or 14 works well for most displays

Color Settings

Set custom colors to visually distinguish different environments. You can customize:

  • Screen text (foreground)
  • Screen background
  • Popup text
  • Popup background
Shortcut properties - Colors

Color scheme ideas:

  • Python 2.5: Blue background with white text
  • Python 2.6: Green background with white text
  • Ruby 1.8: Red background with white text
  • Java: Orange background with black text

Layout Settings

Configure the window size and buffer settings for your workflow.

Shortcut properties - Layout

Recommended settings:

  • Screen buffer width: 120
  • Screen buffer height: 3000 (for scrollback)
  • Window width: 120
  • Window height: 30

The Result

Here's what a customized command prompt looks like in action:

Customized command prompt

Practical Usage Examples

Switching Between Python Versions

Create three shortcuts:

  • "Python 2.4" → Uses python-2.4-config.bat
  • "Python 2.5" → Uses python-2.5-config.bat
  • "Python 2.6" → Uses python-2.6-config.bat

When you need to work on a project that requires Python 2.4, just launch the "Python 2.4" shortcut. All commands in that window will use Python 2.4. Open another shortcut for Python 2.6 work simultaneously.

Multiple Language Environments

You can create shortcuts for different languages entirely:

  • Python 2.5 Development
  • Ruby 1.8 Development
  • Java 1.5 Development
  • Perl 5.8 Development

Each environment remains completely isolated from the others.

Project-Specific Environments

For larger projects, create project-specific configurations:

myproject-env-config.bat:

@echo off
REM MyProject Development Environment

REM Set project paths
SET PROJECT_HOME=C:\Projects\MyProject
SET PYTHON_HOME=C:\Python25
SET PATH=%PYTHON_HOME%;%PROJECT_HOME%\tools;%PATH%

REM Change to project directory
CD /D %PROJECT_HOME%

REM Custom prompt
PROMPT [MyProject] $P$G
TITLE MyProject Environment

echo ========================================
echo  MyProject Development Environment
echo ========================================
echo  Python: %PYTHON_HOME%
echo  Project: %PROJECT_HOME%
echo ========================================
echo.

Best Practices

Organization Tips

  1. Create a dedicated config folder: Store all .bat files in C:\config-files\ or similar
  2. Use consistent naming: Follow the pattern system-version-config.bat
  3. Hide the config folder: Right-click → Properties → Hidden to reduce clutter
  4. Group shortcuts: Create a folder on your desktop or Start Menu for all environment shortcuts

Advanced Configuration

You can add more sophisticated logic to your batch files:

@echo off
REM Advanced Python 2.5 Configuration

REM Check if Python is installed
IF NOT EXIST "C:\Python25\python.exe" (
    echo ERROR: Python 2.5 not found at C:\Python25
    echo Please install Python 2.5 or update the path
    pause
    exit
)

REM Set environment
SET PYTHON_HOME=C:\Python25
SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\Scripts;%PATH%

REM Additional environment variables
SET PYTHONPATH=%PYTHON_HOME%\Lib;%PYTHON_HOME%\Lib\site-packages

REM Custom prompt
PROMPT [Python 2.5] $P$G
TITLE Python 2.5 Environment

echo Python 2.5 Environment Ready
python --version
echo.

Keyboard Shortcuts

Assign keyboard shortcuts to your environment shortcuts for even faster access:

  1. Right-click the shortcut → Properties
  2. Click in the "Shortcut key" field
  3. Press your desired key combination (e.g., Ctrl+Alt+P for Python)
  4. Click OK

Now you can launch your Python 2.5 environment with a single key combination!

Troubleshooting

Common Issues

Problem: "The system cannot find the path specified" Solution: Check that the path in your batch file uses backslashes (\) not forward slashes (/)

Problem: Command prompt opens and immediately closes Solution: Use /K flag instead of /C in your shortcut command

Problem: Wrong version still executes Solution: Check your system PATH – versions earlier in PATH take precedence

Problem: Changes don't persist between sessions Solution: This is expected – each shortcut creates an isolated environment. To make changes permanent, modify the batch file.

Conclusion

Managing multiple versions of programming languages on Windows doesn't have to be painful. By creating custom command prompt shortcuts with environment-specific batch files, you can:

  • Switch between versions instantly
  • Run multiple versions simultaneously
  • Keep your system PATH clean
  • Avoid conflicts between projects
  • Customize each environment's appearance

This approach is elegant, maintainable, and scales well as you add more languages and versions to your development toolkit.

Now you're ready to enjoy truly flexible multi-version development on Windows! Last modified: 2026-01-15 WordPress ID: 65

By Shishir Sharma

Shishir Sharma is a Software Engineering Leader, husband, and father based in Ottawa, Canada. A hacker and biker at heart, and has built a career as a visionary mentor and relentless problem solver.

With a leadership pedigree that includes LinkedIn, Shopify, and Zoom, Shishir excels at scaling high-impact teams and systems. He possesses a native-level mastery of JavaScript, Ruby, Python, PHP, and C/C++, moving seamlessly between modern web stacks and low-level architecture.

A dedicated member of the tech community, he serves as a moderator at LUG-Jaipur. When he’s not leading engineering teams or exploring new technologies, you’ll find him on the open road on his bike, catching an action movie, or immersed in high-stakes FPS games.

One reply on “Multi-version environment on Windows”

Leave a Reply to Yagraj Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.