Run As Administrator.



  • Hi! ✌️

    How do I run a specific file as an administrator?
    For example TEST.txt



  • What exactly do you mean by run a file?
    Executing?
    Opening/Reading?
    Saving/Writing?

    When doing one of the above mentioned actions, the process needs to
    have the proper rights to do so. In case of executing and saving there
    are workarounds to have an unprivileged process doing this by using
    tools like runas and plugins like SaveAsAdmin, which themself
    will spawn a new process with the proper rights.

    When trying to open a file for reading it isn’t that easy, afaik.
    You can start npp with an administrative account but this means
    all of your files opened/saved do get treated with the privilege.



  • @Ekopalypse said in Run As Administrator.:

    I have a file called “RunScript_Notepad++.ahk”.

    I added the script to the menu > Run > Run… F5
    But it works only if I go - NotePad++.exe > Right-click > Properties > Compatibility > Run this program as administrator

    How do I set up the administrator rights only for this file❓



  • You would, for example, use runas.

    In run menu, you would call cmd /k runas /user:YOUR_NAME@YOUR_HOST PROGRAM_TO_EXECUTE

    Once everything works as expected, you can substitute /k with /c and
    the cmd shell gets closed automatically.


Log in to reply