Skip to content

Instantly share code, notes, and snippets.

@Far-Se
Last active June 18, 2022 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Far-Se/79b8959eb80dac159453d24d48ead154 to your computer and use it in GitHub Desktop.
Save Far-Se/79b8959eb80dac159453d24d48ead154 to your computer and use it in GitHub Desktop.
Visual Studio Code Lite - Open a file in a separate user-profile & extension-list Vs Code

Usually when I open random files I open them with Notepad++ because I do not want to open VsCode with all installed extensions, first seconds usually lags few times.

So I come up with idea to make a separate profile for random files, then make a Shell Registry Key to open any file with it:

image

  1. Go to C:\ProgramData\ and create a folder VSCodeLite
  2. Create a icon, for example use this icon then convert with this tool
  3. Put the file in folder from 1 and name is vscodegreen.ico
  4. Create a file VSCodeLite.reg and add code below. Change {{YOURUSERNAME}} to your username.

ProTip: You can create other 2 attached files, but them in same folder, make a shortcut of .vbs, change the icon to green and pin it to StartMenu

First run will take few second, but any other run will be smooth and almost instant. I put the sidebar on right to feel more like a text editor and not a full IDE. You can install extensions that you need.

"%LocalAppData%\Programs\Microsoft VS Code\Code.exe" -n --extensions-dir "C:\ProgramData\VSCodeLite\ext" --user-data-dir "C:\ProgramData\VSCodeLite\user"
strPath = Wscript.ScriptFullName
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPath)
strFolder = objFSO.GetParentFolderName(objFile)
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & strFolder & "\codelite.bat" & Chr(34), 0
Set WshShell = Nothing
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\VSCodeLite]
"Icon"="C:\\ProgramData\\VSCodeLite\\vscodegreen.ico"
@="Open with Code &Lite"
[HKEY_CLASSES_ROOT\*\shell\VSCodeLite\command]
@="\"C:\\Users\\{{YOURUSERNAME}}\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" -n --extensions-dir \"C:\\ProgramData\\VSCodeLite\\ext\" --user-data-dir \"C:\\ProgramData\\VSCodeLite\\user\" \"%1\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment