Use code command to run VSCode Insiders

August 05, 2022

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.

  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.
  2. Open VSCode Insiders path "C:\Users\<your-user-name>\AppData\Local\Programs\Microsoft VS Code Insiders\bin" in the File Explorer
  3. Create the new file "code.cmd" in this folder
  4. 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.

  1. 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.

  1. Add the new line at the end of this file and type:
Set-Alias -Name code -Value code-insiders
  1. 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.

Comments

  • iuriimattos

    November 21, 2022

    working! ( vscode insiders > help > about ) info: Version: 1.74.0-insider (user setup) Commit: fef85ea792f6627c83024d1df726ca729d8c9cb3 Date: 2022-11-21T05:22:37.848Z Electron: 19.1.3 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Windows_NT x64 10.0.22000 Sandboxed: Yes


  • Andrew Malkov

    November 28, 2022

    2 iuriimattos - I'm glad that it works for you!


Leave your comment