Use code command to run VSCode Insiders
August 05, 2022
- Categories
- VSCode
Recently I completely moved from VSCode to VSCode Insiders. It means that I uninstall VSCode and I have only VSCode Insiders installed now.
The most annoying problem I have is that now, if I want to run VSCode Insiders, I have to type in the Windows Terminal:
code-insiders .
versus very simple command that I used to use
code .
However it's very easy to solve this really annoying issue. Below are the steps if you are on Windows.
Option 1
Note:
22.08.2022 I updated this article with Option 3 that I recommend to use it over Option 1 and Option 2.
21.08.2022 I updated this article with Option 2 that I recommend to use it over Option 1.
- Make sure that you have the VSCode Insiders path
"C:\Users\<your-user-name>\AppData\Local\Programs\Microsoft VS Code Insiders\bin"
in the system environment variable PATH. - Open VSCode Insiders path
"C:\Users\<your-user-name>\AppData\Local\Programs\Microsoft VS Code Insiders\bin"
in the File Explorer - Create the new file
"code.cmd"
in this folder - Edit this file and add the next content:
@echo off
code-insiders.cmd %*
This method works well, but as I recently found, it works until you update the VSCode Insiders only. After the update, your file code.cmd
will disappear.
So, I update this article and added the Option 2 that is easier and works forever (edited: as I found it's not true).
Option 2
This option is much easier. Just open your terminal and type the next PowerShell command:
Set-Alias -Name code -Value code-insiders
This will create the alias 'code' that will point to code-insiders.cmd.
This option works well until you restart your terminal. When you open a new Terminal it will "forget" about your alias because Set-Alias
command creates an alias in the current PowerShell session only.
So, I update this article and added the Option 3 (the last one, I promise) that works forever.
Option 3
This options is built on top of the Option 2.
- Open your Terminal and type:
code-insiders $profile
It will open the VSCode with your profile
file located in C:\Users<your-user-name>\Documents\PowerShell\Microsoft.PowerShell_profile.ps1.
- Add the new line at the end of this file and type:
Set-Alias -Name code -Value code-insiders
- Save the file.
This will add this command to your profile
file that will be run every time you open your Terminal session. So, it will create this alias forever (actually, until you remove this command from this file).
How to check that it works
To check that any option works you can type the next command in the terminal:
code --version
And if you see the version of VSCode Insiders then everything works well.
That's it.