Last active
September 16, 2019 10:13
-
-
Save espresso3389/f5d2d0f99d9a42d38407c44bb8e407cc to your computer and use it in GitHub Desktop.
Script to configure VSCode not to use GPU acceleration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enabledelayedexpansion | |
rem Additional options to append to VSCode launching command lines. | |
set ADDTIONAL_OPTS=--disable-gpu | |
rem insiders, exploration, or other for normal version. | |
set FLAVOR=insiders | |
rem VSCode, VSCode Insiders, VSCode Exploration,... | |
if %FLAVOR%==insiders ( | |
set VSCode=VSCodeInsiders | |
set VSCodeExe=Code - Insiders.exe | |
set VSCodeDir=Microsoft VS Code Insiders | |
set VSCodeInternalName=code-insiders | |
) else if %FLAVOR%==exploration ( | |
set VSCode=VSCodeExploration | |
set VSCodeExe=Code - Exploration.exe | |
set VSCodeDir=Microsoft VS Code Exploration | |
set VSCodeInternalName=code-exploration | |
) else ( | |
set VSCode=VSCode | |
set VSCodeExe=Code.exe | |
set VSCodeDir=Microsoft VS Code | |
set VSCodeInternalName=code | |
) | |
set VSCodeExePath=%%LOCALAPPDATA%%\Programs\%VSCodeDir%\%VSCodeExe% | |
reg add "HKCR\*\shell\%VSCode%\command" /f /ve /t REG_EXPAND_SZ /d "\"%VSCodeExePath%\" \"%%1\" %ADDTIONAL_OPTS%" >NUL | |
reg add "HKCR\Applications\%VSCodeExe%\shell\open\command" /f /ve /t REG_EXPAND_SZ /d "\"%VSCodeExePath%\" \"%%1\" %ADDTIONAL_OPTS%" >NUL | |
reg add "HKCR\Directory\Background\shell\%VSCode%\command" /f /ve /t REG_EXPAND_SZ /d "\"%VSCodeExePath%\" \"%%V\" %ADDTIONAL_OPTS%" >NUL | |
reg add "HKCR\Directory\shell\%VSCode%\command" /f /ve /t REG_EXPAND_SZ /d "\"%VSCodeExePath%\" \"%%V\" %ADDTIONAL_OPTS%" >NUL | |
reg add "HKCR\Drive\shell\%VSCode%\command" /f /ve /t REG_EXPAND_SZ /d "\"%VSCodeExePath%\" \"%%V\" %ADDTIONAL_OPTS%" >NUL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On certain machines, Chromium and its derivatives like Electron may cause problems and only the cure is to add --disable-gpu on its launching command line. For launch shortcuts, it's relatively easy but if it comes to context menu or file associations, it get more complex and we need such script to do it automatically.