2
1
I just installed Visual Studio Code 1.28.1, but I'm unable to associate it with the .txt
extension on Windows 10.
I'm well aware how to associate an extension with an application on Windows. I can right-click in Explorer, select, "Open As...", select the application, and make sure "Always open with this app" is checked. Or I can go in to the properties of a file in Explorer, look at "Opens with", and click on "Change". Or I can go to "Choose default apps by file type …", etc. The problem is that none of this is working with VS Code.
Currently my .txt
files are associated with EmEditor. I change the association to Notepad. No problem. I change the association back to EmEditor. That works.
But if I select the blue "Visual Studio Code" option that appears in the list of applications, nothing changes. The old association remains.
I even tried ignoring the blue icon in the selection list, and manually browsed and selected %LocalAppData%\Programs\Microsoft VS Code\Code.exe
as the default editor. That doesn't work, either. Nor did manually selecting %LocalAppData%\Programs\Microsoft VS Code\bin\code.cmd
.
In case you think this might be related to EmEditor, I tried to associate .tidyconfig
files (which on my system are currently not associated with any editor at all) with VS Code. It did nothing.
What's going on? Associating VS Code with my text files should be the most basic of basic Windows integration. Why won't it work?
(I filed this as VSCode Issue #61084, but I had no responses. I'm filing it here in case the "bug" is some sort of user error.)
Did you try to run the command manually per command line, like
"%LocalAppData%\Programs\Microsoft VS Code\Code.exe" "sometxt.txt"
? – musicman – 2018-10-17T17:23:46.157What does that have to do with associating the application with the file type via extension in Windows Explorer? – Garret Wilson – 2018-10-17T17:30:13.203
To see if it is working at all to open the textfile with this application? You might also want to inspect and share the contents of your win registry regarding the file type association. – musicman – 2018-10-17T17:37:06.213
Yes, I can edit text files just fine. The editor is working fine. This question is about association with a file type based upon extension in Windows Explorer. Have you personally tried to associate Visual Studio Code 1.28.1 with the
.txt
extension in Windows 10? What was the result for you? Did you succeed? – Garret Wilson – 2018-10-17T17:39:14.447Possible duplicate. https://superuser.com/questions/1367271/can-notepad-be-replaced-with-vs-code/1367280#1367280
– HazardousGlitch – 2018-10-19T22:37:38.417@HazardousGlitch, no, that's not a duplicate. That's just another way to attempt to do what Windows is still not allowing me to do. That approach doesn't work, either, unfortunately. – Garret Wilson – 2018-10-19T23:23:00.983
(1) Is
EmEditor
still installed? Can you uninstall it and reboot to see if it now becomes easier to set the association? (2) In registry keyHKEY_CLASSES_ROOT\.txt
does the item(Default)
havetxtfile
as value? (3) What is in keyHKEY_CLASSES_ROOT\txtfile\shell\open\command
the value of(Default)
? – harrymc – 2018-10-20T11:43:21.623Let me take EmEditor out of the equation altogether. I just tried to associate a
.tidyconfig
file with VS Code. This extension has nothing associated with it at all. Even that didn't work. – Garret Wilson – 2018-10-20T15:11:46.877That leaves my above questions (2) and (3). – harrymc – 2018-10-20T19:22:06.070
@harrymc I think you missed the point that if it can't even associate with
.tidyconfig
, then we don't even have to look at theHKEY_CLASSES_ROOT\.txt
because now we are usingHKEY_CLASSES_ROOT\.tidyconfig
, which doesn't even exist. In other words, I have eliminated the whole issue of something incorrectly being configured in the registry for that extension. But to answer your questions,HKEY_CLASSES_ROOT\.txt
for(Default)
hasemeditor64.txt
, andHKEY_CLASSES_ROOT\txtfile\shell\open\command
for(Default)
has%SystemRoot%\system32\NOTEPAD.EXE %1
. – Garret Wilson – 2018-10-21T00:17:23.253HKEY_CLASSES_ROOT\.txt
is already taken over by EmEditor. It would be interesting to know if you change it totxtfile
and started EmEditor whether it would re-take it over. For the.tidyconfig
problem, please give more information about what exactly you did to the registry. Check it against this article. – harrymc – 2018-10-21T10:05:21.890I didn't do anything in the registry for
.tidyconfig
. I just tried to associate VS Code with the.tidyconfig
extension as I would with any extension in Windows 10, as I explained in the description of this question. – Garret Wilson – 2018-10-21T14:39:04.060Tell us exactly what you did for
.tidyconfig
. – harrymc – 2018-10-23T17:52:58.9931
Possible duplicate of SSMS wont give up file associations
– Scott – 2018-11-11T17:42:58.037