I want to be able to press .
in any folder that I'm in File Explorer and open Visual Studio Code on that folder. It is the same effect as right-clicking and clicking "Open with Code". Pressing .
is just like I could do on the GitHub website.
It might not be officially possible, but are there any workarounds to make it work?
Thank you @AdrAs and @SarvinR for the answers. I used Sarvin's solution for a while, while trying to google and make sense of Adr's solution. Sarvin's solution is very useful if you're not trying to download any external programs, but if you want the true solution to this question, I finally managed it here:
Download AutoHotKey. It's good if you're familiar with it. AHK basically creates hotkeys (or shortcuts) like Adr described.
(If you have an existing ahk that you use, you can skip these steps and copy the code block down below) Create a new AutoHotKey script by right-clicking on your desktop or anywhere in file explorer (we're gonna move it later so it doesn't matter). Name it whatever you want. I'm going to call it
MyScript.ahk
for this answer (I actually useddavid.ahk
for myself).Now, open command prompt (
win + r
,cmd
,enter
) and look for where VSCode is by typingwhere code
. It will probably give you two lines. Take note of one of the lines (I chose the top one).Right-click the
ahk
script file that you just created and chooseEdit Script
(or you can open it with notepad++ or VSCode or any editor of your choice, it's just a normal text file). Delete everything and paste this in:On the second last line, replace the VSCode location with what you just saw in cmd. You most likely have to just change the username from
david
to your name.Now, save the file try opening it (double click the
ahk
). If it works, a greenH
icon should appear on your tray without any errors. Go into any file directory in Windows File Explorer and hit.
like you would normally do in GitHub. (Do Not do this in large directories like your root C:. There will be too many files for VSCode to load). It should work like expected, and if it doesn't, you did something wrong (I did the exact same thing like I just described and it works).Now, of course, you would want to run this script on startup. Copy/Move the
.ahk
file intoC:\Windows\System32
. It will ask you for administrator permissions, so click yes. Open the registry editor (win + r
,regedit
,enter
). Navigate toHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
. On the right side pane, right click on the empty space then create a new String Value with any name (I useddavidAHK
) and set its value to your ahk file that you just copied/moved with quotes ("C:\Windows\System32\david.ahk"
for my case). Close the Registry Editor and safely restart your computer. The ahk script should run on start up and you should be able to click.
in any directory in file explorer to open VSCode.Again, thank you @AdrAs and @SarvinR for your help!