jueves, 12 de enero de 2017

Agregar "Abrir con Notepad++" para el menú contextual del Explorador de Windows

Abrimos el cmd ( "Windows + R" y escribimos "cmd" ) con permiso de administrador  y copamos el siguiente código. Pulsamos intro y, "Listo".

Nota: Revisa el directorio (notepadPath) donde tienes instalado el programa notepad++. En mi caso particular, notepad se encuentra en la siguiente ruta C:\Program Files (x86)\npp.7.2\ 
 
@echo off
SET notepadPath=C:\Program Files (x86)\npp.7.2\notepad++.exe
 
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with notepad++"         /t REG_SZ /v "" /d "Open with notepad++"   /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with notepad++"         /t REG_EXPAND_SZ /v "Icon" /d "%notepadPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with notepad++\command" /t REG_SZ /v "" /d "%notepadPath% %1" /f 

rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with notepad++" /t REG_SZ /v "" /d "Open with notepad++" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with notepad++" /t REG_EXPAND_SZ /v "Icon" /d "%notepadPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with notepad++\command" /t REG_SZ /v "" /d "%notepadPath% %1" /f
pause

A modo de ejemplo vamos a hacerlo lo mismo para Brackets, para ver que es aplicable para todos los programas.

@echo off
SET st2Path=C:\Program Files (x86)\Brackets\Brackets.exe
 
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Brackets"         /t REG_SZ /v "" /d "Open with Brackets"   /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Brackets"         /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open Brackets\command" /t REG_SZ /v "" /d "%st2Path% \"%1\"" /f 

rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Brackets" /t REG_SZ /v "" /d "Open with Brackets" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Brackets" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Brackets\command" /t REG_SZ /v "" /d "%st2Path% \"%1\"" /f
pause