How to Change VS Code Code.exe Path for Update?

Viewed 5852

[Windows 10] I have "Microsoft VS Code (User Setup)" installed in a custom directory and whenever I try to update it this shows up:

Error Prompt 1

and then this

Error Prompt 2

Log Info

Dec 23 11:42:40.673 INFO Starting: C:\Users\jeremy\AppData\Local\Programs\Microsoft VS Code\Code.exe, false
Dec 23 11:42:40.674 ERRO Bad arguments: Code path doesn't seem to exist: C:\Users\jeremy\AppData\Local\Programs\Microsoft VS Code\Code.exe

How do I change the path to point it to the right directory where "Code.exe" exists?

2 Answers

I had the same problem recently. I ended up reinstalling VS Code.

Do I lose my settings?

No. Note that I did not uninstall VS Code, I just downloaded the installer from the website and installed VSCode. This won't hurt, as it does not touch your settings and extensions.


What I tried

I first tried to visit the path mentioned in the error log, and I noticed that the folder _ within that directory contained the new VS Code version, downloaded by the updater.

So the path should have been C:\Users\myusername\AppData\Local\Programs\Microsoft VS Code\_\Code.exe instead, perhaps.

I tried to move all files from _ to their parent directory, and then, in VS Code, Help » Restart to update. This opened the new version of VS Code, but after closing it and starting it from the original install location (or through a shortcut I have always been using), the old version was still loaded. So apparently, this "trick" didn't work.

Then I tried to make a symbolic link to Code.exe within the _ directory, so the VS Code updater would find Code.exe. This caused roughly the same things to happen. So, this didn't work either.

At last, I decided to just download VS Code from their website, and simply install it. This seemed the most simple option to me.

Create a hard link for Code.exe using mklink, works for me.

Command should look like this (depends where your custom installation is, my in C:/Program Files/Microsoft VS Code/):

mklink /H "C:/Users/$username/AppData/Local/Programs/Microsoft VS Code/Code.exe" "C:/Program Files/Microsoft VS Code/Code.exe"
Related