Skip to content

Instantly share code, notes, and snippets.

@rgl
Created January 20, 2017 11:54
Show Gist options
  • Select an option

  • Save rgl/f1e290a55d58f8d0c24fb1bb95143c5e to your computer and use it in GitHub Desktop.

Select an option

Save rgl/f1e290a55d58f8d0c24fb1bb95143c5e to your computer and use it in GitHub Desktop.
replace notepad with notepad++
choco install -y notepadplusplus.install
# replace notepad with notepad++.
# see http://sbs.seandaniel.com/2009/03/replacing-windows-applications-safe-way.html
[IO.File]::WriteAllText(
'C:\Program Files\Notepad++\launch.js',
@'
var cmd = '"C:\\Program Files\\Notepad++\\notepad++.exe"';
for (var n = 1; n < WSH.Arguments.Length; ++n) {
cmd += ' "' + WSH.Arguments.Item(n) + '"'; // TODO do proper escaping.
}
//WSH.echo(cmd);
WSH.CreateObject("WScript.Shell").Run(cmd);
'@)
New-Item -Force -Path 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe' `
| Set-ItemProperty -Name Debugger -Value 'wscript "C:\Program Files\Notepad++\launch.js"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment