Created
January 20, 2017 11:54
-
-
Save rgl/f1e290a55d58f8d0c24fb1bb95143c5e to your computer and use it in GitHub Desktop.
replace notepad with notepad++
This file contains hidden or 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
| 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