如何将 Notepad++ 设为 PowerShell 中的默认编辑器?

如何将 Notepad++ 设为 PowerShell 中的默认编辑器?

在 POSH-GIT(PowerShell 的 Git 插件)中,当我发出“提交”命令时,Notepad++ 会打开以输入提交注释,并且与普通的 Notepad++ 操作不同,当我使用 退出时,它会提示保存Alt-X

每次使用 PowerShell 时如何设置?

所谓“默认编辑器”,是指我想输入edit <filename>,并让 Powershell 在 Notepad++ 中打开该文件,但在关闭 Notepad++ 时会提示保存,这不是正常行为。至少在我的系统中不是这样;Notepad++ 在关闭时只会将打开的文件缓存在内存/磁盘上。

答案1

这实际上不是我问题的答案,但这是我找到的最接近的答案。这是一个 PowerShell 脚本,可在整个系统范围内用 Notepad++ 完全替换 Notepad。

在 Windows 10 中使用 PowerShell 将 Notepad.exe 替换为 Notepad++

链接脚本notepad.exe将原始文件移动到 后,仅将文件替换为 Notepad++ 的可执行文件notepad.exe.bak。并且,如果 Notepad++ 是 7.5.9 或更高版本,则会在键 中添加一个值HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe

相关内容