Tapatalk

How to use UltraEdit as default editor for *.txt files but keep default icon for text files?

How to use UltraEdit as default editor for *.txt files but keep default icon for text files?

2
NewbieNewbie
2

    Jan 03, 2018#1

    Hello!

    I want to use UltraEdit as my text editor but I want to keep default icon too. (Notepad default icon in Windows 10.)

    Could someone please help me how to do this configuration?

    6,685587
    Grand MasterGrand Master
    6,685587

      Jan 03, 2018#2

      What exactly do you mean? Do you want to have a shortcut on your desktop starting UltraEdit, but having the Notepad icon?

      Or do want to associate file extension .txt with UltraEdit instead of Notepad, but keep the Notepad icon for *.txt files on displaying a directory list in Windows Explorer?

      Please post the version of UltraEdit used by you with the information of using 32-bit or 64-bit UltraEdit. And please post also the version of Windows used by you. And post how you have configured UltraEdit as default text editor respectively as default application for opening files with file extension ...
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Jan 03, 2018#3

        Thanks for your attention.
        I want to describe my issue exactly. I want to double click on .txt file and the files opens in UE but with the icon shown in Explorer should be the default icon of Notepad.
        I can't do both of them at same configuration if I associate UE as default text editor I am able to open text file just by double clicking on .txt file but the icon changes to UE icon too.

        My OS : Windows 10 x64 version 1709 (Build 16299.125)
        UltraEdit : 64-bit  v24.20.0.51

        6,685587
        Grand MasterGrand Master
        6,685587

          Jan 04, 2018#4

          Here are the necessary steps to associate UltraEdit as default application for opening .txt files but keep default icon for text files with that file extension.
          1. In UltraEdit open Advanced - Settings or Configuration - File associations and click on button System File Associations.
            This opens the Set Associations window of Windows. This window could be also opened in background with a blinking item on Windows task bar at bottom indicating that this window needs your attention. Click on the task bar item to bring the window to foreground.
          2. Click with primary (left) mouse button once into the list and quickly type .txt to jump to this file extension in list, or alternatively scroll down the vertical scroll bar and search with your eyes instead of your fingers for the line with .txt.
          3. Double click on line with file extension .txt, or select the line with a single click and click on button Change program....
          4. Double click on UltraEdit Professional Text/Hex Editor either in list of Recommended Programs or in list of Other Programs after clicking on [+] symbol to display this list, or alternatively select UltraEdit Professional Text/Hex Editor with a single primary mouse button click and then click on button OK.
          5. Back in Set Associations window click on button Close.
          6. Back in Configuration window of UltraEdit click on button Cancel.
          7. Open a command prompt window and run following two commands or run them from within UltraEdit using Run DOS command in Advanced:

            Code: Select all

            reg delete "HKEY_CURRENT_USER\Software\Classes\.txt" /f
            
            reg delete "HKEY_CURRENT_USER\Software\Classes\UltraEdit.txt" /f
            Ignore the error message output by reg if the key to delete could not be found in registry.
            For the reason for executing those two commands read below.
            Close the command prompt window on having one opened.
          The steps using Windows file association dialog add two keys with string values to Windows registry.

          The first registry key added if not already present is:

          HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithList

          The string added has a name with a small letter like a on being the first item in this list with value uedit64.exe (for 64-bit UltraEdit). And added is a second string with name MRUList if not already existing with value a respectively with the letter of added string inserted at beginning of the letters in this most recently used list.

          However, this key has no importance for opening a *.txt file on double click in UltraEdit. I added this information just for completeness.

          Important for opening *.txt files in UltraEdit is the second registry key added by Windows:

          HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\UserChoice

          The string value added to this key has the name Progid and the value Application\uedit64,exe.

          To undo this user choice it is possible to do the same steps as above, but select Notepad as application to use for opening a file with file extension .txt instead of UltraEdit, or run following command line in a command prompt window or from within UltraEdit using Advanced - Run DOS command:

          Code: Select all

          reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\UserChoice" /f

          How does this modification work?

          By default Windows Vista and later Windows versions have registered the file extension .txt with following keys and values in registry.

          Code: Select all

          [HKEY_LOCAL_MACHINE\Software\Classes\.txt]
          @="txtfile"
          "Content Type"="text/plain"
          "PerceivedType"="text"
          
          [HKEY_LOCAL_MACHINE\Software\Classes\.txt\PersistentHandler]
          @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
          
          [HKEY_LOCAL_MACHINE\Software\Classes\.txt\ShellNew]
          "ItemName"=hex(2):40,25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,6d,\
            33,32,5c,6e,6f,74,65,70,61,64,2e,65,78,65,2c,2d,34,37,30,00
          "NullFile"=""
          
          The value ItemName is of type REG_EXPAND_SZ with string value @%SystemRoot%\system32\notepad.exe,-470 containing environment variable reference %SystemRoot% which must be expanded by Windows to get real string.

          Important is the default string txtfile of registry key HKEY_LOCAL_MACHINE\Software\Classes\.txt as it defines which other registry key in HKEY_LOCAL_MACHINE\Software\Classes defines the possible commands to use with files with that extension and with which icon the files with .txt as extension should be displayed in Windows Explorer.

          Code: Select all

          [HKEY_LOCAL_MACHINE\Software\Classes\txtfile]
          @="Text Document"
          "EditFlags"=dword:00010000
          "FriendlyTypeName"=hex(2):40,25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,\
            74,65,6d,33,32,5c,6e,6f,74,65,70,61,64,2e,65,78,65,2c,2d,34,36,39,00
          
          [HKEY_LOCAL_MACHINE\Software\Classes\txtfile\DefaultIcon]
          @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,69,\
            6d,61,67,65,72,65,73,2e,64,6c,6c,2c,2d,31,30,32,00
          
          [HKEY_LOCAL_MACHINE\Software\Classes\txtfile\shell]
          
          [HKEY_LOCAL_MACHINE\Software\Classes\txtfile\shell\open]
          
          [HKEY_LOCAL_MACHINE\Software\Classes\txtfile\shell\open\command]
          @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,6e,\
            6f,74,65,70,61,64,2e,65,78,65,20,25,31,00
          
          [HKEY_LOCAL_MACHINE\Software\Classes\txtfile\shell\print]
          
          [HKEY_LOCAL_MACHINE\Software\Classes\txtfile\shell\print\command]
          @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,6e,\
            6f,74,65,70,61,64,2e,65,78,65,20,2f,70,20,25,31,00
          
          [HKEY_LOCAL_MACHINE\Software\Classes\txtfile\shell\printto]
          
          [HKEY_LOCAL_MACHINE\Software\Classes\txtfile\shell\printto\command]
          @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,6e,\
            6f,74,65,70,61,64,2e,65,78,65,20,2f,70,74,20,22,25,31,22,20,22,25,32,22,20,\
            22,25,33,22,20,22,25,34,22,00
          The value FriendlyTypeName is of type REG_EXPAND_SZ with string value @%SystemRoot%\system32\notepad.exe,-469
          The default value of key DefaultIcon is of type REG_EXPAND_SZ with string value %SystemRoot%\system32\imageres.dll,-102
          The default value of key open\command is of type REG_EXPAND_SZ with string value %SystemRoot%\system32\notepad.exe %1
          The default value of key print\command is of type REG_EXPAND_SZ with string value %SystemRoot%\system32\notepad.exe /p %1
          The default value of key printto\command is of type REG_EXPAND_SZ with string value %SystemRoot%\system32\notepad.exe /pt "%1" "%2" "%3" "%4"

          So the icon for .txt files is by default not an icon stored in notepad.exe, but in dynamic linked library imageres.dll in system folder of Windows. The command open executed on double clicking on .txt file results in executing notepad.exe with the full name of the double clicked file as first argument.

          But with current user registry key UserChoice with string value Progid and the value Application\uedit64,exe the open command for .txt file is redirected to:

          Code: Select all

          [HKEY_CURRENT_USER\Software\Classes\Applications\uedit64.exe]
          
          [HKEY_CURRENT_USER\Software\Classes\Applications\uedit64.exe\shell]
          
          [HKEY_CURRENT_USER\Software\Classes\Applications\uedit64.exe\shell\edit]
          
          [HKEY_CURRENT_USER\Software\Classes\Applications\uedit64.exe\shell\edit\Command]
          @="\"C:\\Program Files\\IDM Computer Solutions\\UltraEdit\\uedit64.exe\" \"%1\""
          
          [HKEY_CURRENT_USER\Software\Classes\Applications\uedit64.exe\shell\open]
          
          [HKEY_CURRENT_USER\Software\Classes\Applications\uedit64.exe\shell\open\Command]
          @="\"C:\\Program Files\\IDM Computer Solutions\\UltraEdit\\uedit64.exe\" \"%1\""
          
          [HKEY_CURRENT_USER\Software\Classes\Applications\uedit64.exe\shell\print]
          
          [HKEY_CURRENT_USER\Software\Classes\Applications\uedit64.exe\shell\print\Command]
          @="\"C:\\Program Files\\IDM Computer Solutions\\UltraEdit\\uedit64.exe\" /p \"%1\""
          These registry keys and values are added by UltraEdit itself on starting UltraEdit the first time by current user since UltraEdit for Windows v19.10 according to my own records.

          There is no key DefaultIcon in HKEY_CURRENT_USER\Software\Classes\Applications\uedit64.exe which is the reason why the files with file extension .txt are displayed still with the icon stored in imageres.dll in system folder of Windows.

          But what is the reason for UltraEdit icon being used for .txt files?

          The UserChoice method is not the only method to override the default configuration for .txt files.

          With elevated privileges of an administrator it is possible to edit the values of registry key txtfile for entire local machine. This method was never used by UltraEdit.

          With elevated privileges of an administrator it is also possible to modify default string value txtfile of registry key HKEY_LOCAL_MACHINE\Software\Classes\.txt to a different string like UltraEdit.txt which contains appropriate registry keys for DefaultIcon and shell\open\command. This method was used in the past by UltraEdit for Windows on using the file associations configuration dialog in UltraEdit up to v24.00 if Windows permitted write access to local machine registry hive. On Windows XP most users used an account with local administrator privileges making it possible for UltraEdit to use this method. But this file association method was no longer available with Windows Vista and by default enabled UAC (user account control) which blocks unconfirmed write access to local machine registry hive even for a user which belongs to local administrator group. UltraEdit stored in registry under UltraEdit.txt also the original default string value txtfile of registry key .txt and restored this string value on deleting the file association in UltraEdit's file associations configuration dialog. This was a feature no Windows version ever offered the user.

          So start regedit.exe which requires a confirmed elevation to local administrator, navigate to HKEY_LOCAL_MACHINE\Software\Classes\.txt and look on right side if the default string at top is UltraEdit.txt instead of txtfile. In this case change the default string to txtfile and delete entire key HKEY_LOCAL_MACHINE\Software\Classes\UltraEdit.txt.

          Alternatively it is possible to run the following two commands from within a command prompt window opened with Run as administrator:

          Code: Select all

          reg add "HKEY_LOCAL_MACHINE\Software\Classes\.txt" /ve /t REG_SZ /d txtfile /f
          
          reg delete "HKEY_LOCAL_MACHINE\Software\Classes\UltraEdit.txt" /f
          
          It is possible that the second command results in output of error message:

          ERROR: The system was unable to find the specified registry key or value.

          This error message can be ignored because a registry key to delete not existing at all is not an error, but the expected result after deletion.

          Since Windows Vista with enabled user account control no application started by a user has write access to local machine registry hive. For that reason the method to change string value of a local machine registry key and adding additional keys in that hive is not possible for any application. But the current user has the permissions to add keys and change values in current user registry hive. And Windows always searches for a registry key/value first in current user and use it if present before searching for same registry key/value in local machine registry hive.

          So up to UltraEdit for Windows v24.00 a file association made with UltraEdit itself in its file associations configuration dialog resulted for example for file extension .txt in adding to Windows registry the keys and values:

          Code: Select all

          [HKEY_CURRENT_USER\Software\Classes\.txt]
          @="UltraEdit.txt"
          
          [HKEY_CURRENT_USER\Software\Classes\.txt\OpenWithProgids]
          "UltraEdit.txt"=""
          
          [HKEY_CURRENT_USER\Software\Classes\UltraEdit.txt]
          @="Text Document"
          
          [HKEY_CURRENT_USER\Software\Classes\UltraEdit.txt\shell]
          
          [HKEY_CURRENT_USER\Software\Classes\UltraEdit.txt\shell\Open]
          
          [HKEY_CURRENT_USER\Software\Classes\UltraEdit.txt\shell\Open\Command]
          @="\"C:\\Program Files\\IDM Computer Solutions\\UltraEdit\\uedit64.exe\" \"%1\""
          
          [HKEY_CURRENT_USER\Software\Classes\UltraEdit.txt\shell\Print]
          
          [HKEY_CURRENT_USER\Software\Classes\UltraEdit.txt\shell\Print\Command]
          @="\"C:\\Program Files\\IDM Computer Solutions\\UltraEdit\\uedit64.exe\" /p \"%1\""
          
          The default string value Text Document of key UltraEdit.txt is the description entered in the file associations dialog of UltraEdit before pressing button Assign.

          So it is perhaps necessary to delete the two registry keys .txt and UltraEdit.txt under HKEY_CURRENT_USER\Software\Classes\ either with regedit.exe with confirmed elevation to local administrator or from within a command prompt window opened normally by executing following two commands:

          Code: Select all

          reg delete "HKEY_CURRENT_USER\Software\Classes\.txt" /f
          
          reg delete "HKEY_CURRENT_USER\Software\Classes\UltraEdit.txt" /f
          
          The error message output on key to delete not existing at all must be again ignored.
          Best regards from an UC/UE/UES for Windows user from Austria