Windows/Softwares/Notepad++

Windows/Softwares/Notepad++

自动保存

Settings - Preference - Backup 里选中 "Remember current session for next launch" 和 "Enable session snapshot and periodic backup" 两个选项,则 Notepad++ 会自动保存所有创建或打开文件的草稿,并且直接关闭也不会提示保存,下次打开会自动恢复之前的草稿。

自动保存位置:

%USERPROFILE%\AppData\Roaming\Notepad++\backup

使用 Notepad++ 替换系统默认的 notepad

Update: 以下方案对 Windows 11 环境无效。

以下示例针对默认安装位置(C:\Program Files\Notepad++)的 Notepad++

  1. 在 Notepad++ 安装目录下创建一个 notepadpp.vbs 文件 (编码 UTF-8 或 ASCII,不能是 UTF-8 BOM)
'put this in your notepad++ installation directory (typically C:Program Files (x86)Notepad++ in x64 windows)

Option Explicit
Dim sCmd, x, arg
sCmd = chr(34) & LeftB(WScript.ScriptFullName, LenB(WScript.ScriptFullName) _
        - LenB(WScript.ScriptName)) _
        & "notepad++.exe" & chr(34)
For x = 1 To WScript.Arguments.Count - 1
    arg = arg & " " & WScript.Arguments( x )
Next
if arg <> "" then
    sCmd = sCmd & " " & chr(34) & trim(arg) & chr(34)
end if
CreateObject("WScript.Shell").Run sCmd, 1, False
WScript.Quit
  1. 导入下面的注册表

npp_x64_editor_on_x64_windows.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe]
"Debugger"="wscript \"C:\\Program Files\\Notepad++\\notepadpp.vbs\""

如果是安装在 64 位 Windows 里的 32 位的 Notepad++,把 "Program Files" 替换为 "Program Files (x86)"


Last update: 2022-06-17 01:53:49 UTC