Edit as Administrator

Edit as Administrator

1

    May 18, 2015#1

    Hey folks, searched around for this and didn't find anything satisfactory. Maybe someone here can help.

    I normally don't want to run UltraEdit as administrator on Windows, but sometimes I want to edit a file that requires administrator permissions (such as hosts). The only ways I have of doing this are either closing UE and re-opening as administrator, or using another program running as administrator to edit the file.

    I would really like to be able to open and edit individual files as administrator, or be asked to provide administrator credentials at the time of save if my account doesn't have permissions to do so.

    I don't think anything like this is built into UE, but is it possible to write a macro or other work-around that would achieve this?

    Thanks!

    -Eric

    6,675585
    Grand MasterGrand Master
    6,675585

      May 21, 2015#2

      UltraEdit for Linux and Mac have the feature to ask the user for (super user / root) credentials when a file can't be saved with current user access rights. UltraEdit for Windows v22.0 does not have such a feature yet.

      A workaround would be to configure in UltraEdit a user tool which uses command RunAs to start a new instance of UltraEdit with administrator privileges and with full name of active file.

      Tab Command:
      Menu item name: Edit as Administrator
      Command line: C:\Windows\System32\runas.exe /env /user:localmachinename\localadministrator "\"C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\uedit32.exe\" /fni \"%f\""
      Working directory: let it empty
      Toolbar bitmap/icon (file path): let it empty or specify full name of a *.bmp, *.png, *.gif, *.jpg or *.ico file containing a suitable icon

      Tab Options:
      Program Type: Windows program
      Save active file: unchecked
      Save all files first: unchecked

      Tab Output:
      Command output (DOS Commands): Append to existing
      Show DOS box: unchecked
      Capture output: unchecked
      Replace selected text with: No replace

      Clicking on this tool results in opening a command prompt window for entering the password for the local administrator account. After password was correct entered, a new instance (parameter /fni - force new instance) of UltraEdit is started with local administrator privileges and opening the active file in this new instance of UltraEdit.

      You could create also a shortcut file (*.lnk) in Send to folder of your user account (%APPDATA%\Microsoft\Windows\SendTo) containing as command line for Target just name of a batch file with full path which contains following two lines:

      Code: Select all

      @echo off
      %SystemRoot%\System32\runas.exe /env /user:localmachinename\localadministrator "\"%ProgramFiles(x86)%\IDM Computer Solutions\UltraEdit\uedit32.exe\" /fni \"%~1\""
      
      Then it is possible to open a file via context menu of Windows Explorer directly in a new instance of UltraEdit running with administrator privileges.

      This Sent to shortcut is also available in context menu opened on right clicking on a file on Explorer tab of File View in UltraEdit after clicking on menu item System Explorer Menu.
      Best regards from an UC/UE/UES for Windows user from Austria