unable to associate .txt file with listed Visual Studio Code on Windows 10
This isn't user error or a Code bug. Microsoft have broken how file associations work in the latest alpha. I found a workaround which works in Windows 10 Pro - Version 1803 - OS Build 17134.320.
Find the command to start Visual Studio Code with a named file: click Start, type "code", right click Visual Studio Code and select Open File Location.
Right click the shortcut, click Properties and copy the contents of Target. This will be something like "C:\Users\[your name]\AppData\Local\Programs\Microsoft VS Code\Code.exe" "%1"
In Registry Editor, create HKEY_CLASSES_ROOT/.txt
and set Default
to txt_auto_file
.
Now create HKEY_CLASSES_ROOT/txt_auto_file/shell/open/command
and set Default
to the text you copied from Target.
At this point you can stop because double clicking a .txt file will now open it in Code. However the icon in Explorer is wrong. Right click the .txt file and select Open With. You'll now find everything works as it should; you can tick Always Use and this will fix the icon.