Running as admin doesn't load previously open files

  • Background
    Notepad++ 7.5.9, running on Windows 10 Enterprise Oct 2018 (1809, Build 17763.168), connected to a domain, configured to allow multiple instances to run. Logged in with a standard non-admin account.

    To workaround the issue of problems when Notepad++ is installed by an admin account but used from a standard account, I always keep 2 instances open now; 1 opened with my standard account and another run as admin using my admin account.

    The problem is whenever I have to restart or otherwise close the admin instance of Notepad++ the next time I start is as admin using the same account when Windows prompts for admin credentials it does not open the files I last had open despite being configured to do so. The instance I open with my standard login remembers and reopens files just fine.

    For example I often edit the \system32\drivers\etc\hosts file so I can assign a URL to a site hosted on my local IIS and use that in the browser. However after a restart that hosts file will not be open despite using the same admin account to run Notepad++ as admin. Shouldn’t it be using the user profile of the account I ran it as?

  • @Peter-Row

    sorry, but as far as I understand, the last instance is triggering writing the session information only.
    So the only workaround I see at the moment is to create an independent shortcut and using a session file
    and every time before you close this instance you want to save the session explicitly.


  • @Peter-Row

    you could also use a single portable version that resides in a folder you can put anywhere (except inside %programfiles% or %programfilesx86%)

    this way you could open the same session files, regardless if this portable notepad++.exe is started as a restricted user or as an administrator (elevated).
    (only prerequisite is that both users have the same available paths and at least read permission to access all the files listed within this session … files without read permissions will not be reopened and purged from the session list)

    basic explanation:
    the portable np++ version confines all internal data including sessions to it’s own folder, so they are persistent to all users that have permission to read and write to this portable np++ folder.
    this behaviour is triggered by the presence of an empty DoLocalConf.xml file.
    the installed version on the other hand will write and read specific np++ internal data and settings inside different locations within the %homepath% of the user account that np++ has been started with

    feel free to download and try the portable np++ version from this location:
    (it will not interfere with your current installation)

  • @Meta-Chuh

    that is better than my suggestion as it allows to have full session functionality aka unsaved files for both accounts.
    Good one :-)