Skip to content

Instantly share code, notes, and snippets.

@jordanbtucker
Last active March 31, 2016 18:04
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 jordanbtucker/e453ee2835a3364f4d96 to your computer and use it in GitHub Desktop.
Save jordanbtucker/e453ee2835a3364f4d96 to your computer and use it in GitHub Desktop.
Add an "Open with Atom" context menu to folders

Open directory in Atom

Right-clicking a file will give you the option to open the file with Atom. Run this batch file to add the same feature to folders and their backgrounds.

@echo off
net session > nul 2>&1
if /i not %errorlevel%==0 (
echo You must run this from an elevated prompt.
goto:eof
)
for /f "delims=" %%a in ('where atom') do set atompath=%%a
call :getdirname "%atompath%"
pushd "%atompath%..\lib"
set atompath=%cd%
for /f "delims=" %%a in ('dir /b Atom.*') do set atomdir=%%a
set atompath=%atompath%\%atomdir%\tools\Atom\atom.exe
reg add HKCR\Directory\shell\Atom /d "Open with Atom" /f > nul 2>&1
reg add HKCR\Directory\Background\shell\Atom /d "Open with Atom" /f > nul 2>&1
reg add HKCR\Directory\shell\Atom\command /d "\"%atompath%\" \"%%V\"" /f > nul 2>&1
reg add HKCR\Directory\Background\shell\Atom\command /d "\"%atompath%\" \"%%V\"" /f > nul 2>&1
popd
goto:eof
:getdirname
set atompath=%~dp1
goto:eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment