From time to time I find myself using Notepad instead of Notepad++ or a better editor. Sometimes I even put important stuff in those notepad windows.

When it comes time to restart my PC, I often have as many as 20 open notepad instances. Granted, most of these are useless, but I have to scan each one to see if there is anything worth saving.

Is there any utility or command available that would do any of the following:

  1. Save all open notepads to a single file
  2. Save all open notepads to default named files
  3. Save the instances of notepad in memory to disk so they start on reboot
  • 2
    :) i do all of these with notepad++ – Baljeetsingh Mar 15 '14 at 2:06

Yes, there is AutoHotKey tool suitable for such a task.

You can create a macro which repeatedly

  1. focuses any window with word Notepad in title (or exits if no such window is found)
  2. sends Ctrl+S to save a file
  3. waits few seconds
  4. if it finds (again by title) "Save as" dialog open (that is, in case of saving of new file), it fills in some default numbered filename (by sending keystrokes) and sends Alt+S to press Save button in dialog
  5. adds command notepad <filename> into restore-notepads.bat file
  6. sends Alt+F4 to close Notepad instance
  7. repeat.

then you can add restore-notepads.bat into your Startup menu and you will find the functionality you described as "3.Save the instances of notepad in memory to disk so they start on reboot" present.


I've been using notepad as a temp text storage since no other programs starts faster. To save or backup the content of notepad instances, I wrote some AHK code. It's basically based on miroxlav's Answer, but I don't need to restore.

So here comes the code.

+!s:: ;Save all notepad instance

    ClipSaved := ClipboardAll 

    LastClip := ""
    WinGet, id, list, *Untitled - Notepad, ,, ;[1]
    Loop, %id%
        this_id := id%A_Index%
        WinActivate, ahk_id %this_id%
        Send ^A
        Send ^C
        Sleep 500
        WinMinimize, ahk_id %this_id%
        WinGetClass, this_class, ahk_id %this_id%
        WinGetTitle, this_title, ahk_id %this_id%
        LastClip = %LastClip% `r`n-------`r`n %ClipBoard% ;[2]
        ToolTip , Saving All Untitled Notepad Instances `n%a_index% of %id%`nahk_id %this_id%`nahk_class %this_class%`n%this_title%`n

    ClipBoard := LastClip
    ; ToolTip , %ClipBoard%

    Run notepad.exe
    Sleep 1000
    Send ^V
    Sleep 1000

    Clipboard := ClipSaved  
    ClipSaved = 

    ToolTip, Done
    SetTimer, RemoveToolTip, 2500

    SetTimer, RemoveToolTip, Off


Save the code into an .ahk file, run it, and after pressing Alt+Shift+S, all untitled notepad instance's content should be merged into one new notepad window.


  • [1] If you want all notepad instances to be saved, not only the untitled one, change the *Untitled - Notepad to ahk_exe notepad.exe should do the job.
  • [2] That's for seperate line.

Though this answer comes from 5 years later, I still hope this will be some help to you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.