How to create Multiple Flutter version Aliases to use in command prompt in Windows PC separately

506

It is very simple to do just follow these steps:

In my case i will be using 2 different commands like flutter for current flutter version and flutterl for latest flutter version.

To create a new alias in windows you should create a new folder. here i have created Aliases, you can create this folder in C directory or wherever you want.

enter image description here

In this folder create a new file flutterl.bat

enter image description here

And right click and edit this file add the following code

@echo off
C:\src\flutter_latest\bin\flutter %*

Here C:\src\flutter_latest is the location, which contain's flutter latest version.

Then goto Environment variables and in the path add this files location. To do this you can follow these steps

  1. Right click on this pc, and click on properties
  2. Click on Advanced Settings
  3. Then click on Environment Variables
  4. Edit Path
  5. Click on new and paste the Location of Aliases folder, that you've created

Same Steps with visuals

  1. Right click on this pc, and click on properties

enter image description here

  1. Click on Advanced Settings

enter image description here

  1. Then click on Environment Variables

enter image description here

  1. Edit Path

enter image description here

  1. Click on new and paste the Location of Aliases folder, that you've created

enter image description here

Now you are good to go. Both flutter and flutterl will be working fine to test then run

flutter doctor
flutterl doctor

If you want to manage the flutter versions for your project only then you can use fvm package, it is a simple cli to manage Flutter SDK versions. Flutter Version Management

Share:
506
Rishabh Bhardwaj
Author by

Rishabh Bhardwaj

Updated on December 25, 2022

Comments

  • Rishabh Bhardwaj
    Rishabh Bhardwaj over 1 year

    I have 2 versions of flutter 1 is latest another is previous, I want to create a 'flutterl' alias for cmd in windows for latest one and 'flutter' for previous one. how to create it ?