How to automatically open README, LICENSE files without file extension?

How to automatically open README, LICENSE files without file extension?

1

    Mar 26, 2009#1

    Can UltraEdit v14.20.1.1001 be configured to automatically open files without an extension, such as README, LICENSE, HELP, etc. when I click on them? I get always the Windows "Open With" dialog.

    Thanks.

    2362
    MasterMaster
    2362

      Mar 26, 2009#2

      If you would like UltraEdit to ALWAYS open files that do not have an extension, then this can be done.

      This will be for any file that does not have an extension, not just README, LICENSE, HELP, etc. Any file that does not have an extension this will work for. This has only been tested on Windows XP SP2+, so I don't guarantee it will work on Windows Vista.
      • Go to Advanced->Configuration->File Associations.
      • In the File types/extensions box, type a period .
      • In the Description box type whatever you want to call this. I put No Extension in mine.
      • Click Add.
      • Click OK.
      That's all there is to it.
      “Don’t document the problem, fix it.” – Atli Björgvin Oddsson

      191
      Basic UserBasic User
      191

        Dec 31, 2019#3

        I am looking for a way to do this (automatically open files without an extension) and found this post.

        I  am using UltraEdit version 26 x64 under Windows 10. The steps above don't work.  I go through the steps above, but still get the Windows File Association Helper when I double click on a file without an extension.

        Has anyone a method to get this to work in this environment?

        6,602548
        Grand MasterGrand Master
        6,602548

          Jan 02, 2020#4

          Yes, this is indeed a challenge since Windows Vista. Microsoft forces every company which wants to be a certified Microsoft partner that their applications just open the Set Associations control panel dialog window instead of doing the file association by the application itself. But Microsoft gives a user just the option to change an already existing file association. There is no possibility anymore for a user to add or remove a file association since Windows Vista using the graphical user interface provided by Windows.

          It was possible with Windows XP to open from Control Panel (or Windows Explorer) the Folder Options, select tab File Types and add or change or remove a file association and even make advanced customizations. But that is not possible anymore on Windows Vista and later Windows versions by using a built-in file association dialog. It is necessary to add a file association from within a command prompt using the command assoc. But this command fails to handle the file extension . for files with no file extension, at least on Windows 7 according to my tests. Another possibility would be using PowerShell on Windows Vista and later Windows versions to add a file association.

          I wrote a Windows batch file for the task to associate a file type including the file type for files with no extension with UltraEdit or UEStudio.

          Code: Select all

          @echo off
          rem Run this batch file in 64-bit and not in 32-bit environment on Windows x64.
          if not "%ProgramFiles(x86)%" == "" if exist %SystemRoot%\Sysnative\cmd.exe (
              %SystemRoot%\Sysnative\cmd.exe /C "%~f0"
              exit
          )
          
          setlocal EnableExtensions DisableDelayedExpansion
          
          rem Define the file extension to add like just . for a file with no extension
          rem or .info or .txt or .text. There is not checked if the file extension is
          rem associated already with a program on making the file association.
          set "FileExt=."
          
          rem Define the description for this file type.
          set "FileType=File with no file extension"
          
          rem Define the program (executable file name) to associate with the file
          rem extension. The string value should be uedit32 or uedit64 or uestudio.
          set "Program=uedit64"
          
          rem Define the registry hive to add the file association. The possible values
          rem are HKCU or HKEY_CURRENT_USER and HKLM or HKEY_LOCAL_MACHINE. The batch
          rem file must be run as administrator on using HKLM or HKEY_LOCAL_MACHINE.
          set "RegHive=HKCU"
          
          rem Change the value to 1 for adding an UE/UES icon for the file type.
          set "AddIcon=0"
          
          if /I "%Program%" == "uestudio" (set "AppName=UEStudio") else set "AppName=UltraEdit"
          
          echo Searching for application registration of %Program%.exe ...
          set "TokenIndex=2"
          :QueryAppPaths
          for %%I in (HKLM HKCU ) do (
              for /F "skip=2 tokens=%TokenIndex%*" %%J in ('%SystemRoot%\System32\reg.exe query "%%I\Software\Microsoft\Windows\CurrentVersion\App Paths\%Program%.exe" /ve 2^>nul') do (
                  if "%%J" == "REG_SZ" if exist "%%~K" set "AppFullName=%%~K" & goto FoundAppName
                  if "%%J" == "NAME>" set "TokenIndex=3" & goto QueryAppPaths
              )
          )
          
          echo/
          echo Error: Could not find %Program%.exe application registration in
          echo        Windows registry or the registered %Program%.exe does not
          echo        exist in registered folder.
          echo/
          echo The installation of %AppName% is not correct done which should be fixed.
          echo/
          
          echo Searching for %Program%.exe in standard installation directories ...
          set "AppFullName=%ProgramFiles%\IDM Computer Solutions\%AppName%\%Program%.exe"
          if exist "%AppFullName%" goto FoundAppName
          set "AppFullName=%ProgramFiles(x86)%\IDM Computer Solutions\%AppName%\%Program%.exe"
          if not "%ProgramFiles(x86)%" == "" if exist "%AppFullName%" goto FoundAppName
          set "AppFullName=%UserProfile%\Documents\IDM Computer Solutions\%AppName%\%Program%.exe"
          if exist "%AppFullName%" goto FoundAppName
          
          echo/
          echo Error: Could not find %Program%.exe in standard installation directories.
          
          :FixInfo
          echo/
          echo        Please fix installation of %AppName% by reinstalling it and
          echo        then run this batch file once again.
          goto EndBatch
          
          :FoundAppName
          echo/
          echo Found: "%AppFullName%"
          echo/
          echo Add registry values for file extension %FileExt% to registry hive %RegHive% ...
          %SystemRoot%\System32\reg.exe ADD "%RegHive%\Software\Classes\%FileExt%" /f /ve /t REG_SZ /d "%AppName%%FileExt%" >nul || goto EndBatch
          %SystemRoot%\System32\reg.exe ADD "%RegHive%\Software\Classes\%FileExt%" /f /v "Content Type" /t REG_SZ /d "text/plain" >nul
          %SystemRoot%\System32\reg.exe ADD "%RegHive%\Software\Classes\%FileExt%" /f /v "PerceivedType" /t REG_SZ /d "text" >nul
          %SystemRoot%\System32\reg.exe ADD "%RegHive%\Software\Classes\%FileExt%\OpenWithProgids" /f /v "%AppName%%FileExt%" /t REG_NONE >nul
          
          setlocal EnableDelayedExpansion
          rem This is a workaround for the commented commmand line above to add the
          rem registry value of type REG_NONE not with two zero bytes to the registry,
          rem but with a zero-length binary value as typical for this value type.
          if /I "%RegHive%" == "HKCU" (
              set "FullRegHive=HKEY_CURRENT_USER"
          ) else if /I "%RegHive%" == "HKLM" (
              set "FullRegHive=HKEY_LOCAL_MACHINE"
          ) else set "FullRegHive=%RegHive%"
          
          (   echo REGEDIT4
              echo/
              echo [%FullRegHive%\Software\Classes\.\OpenWithProgids]
              echo "%AppName%!FileExt!"=hex(0^):
          )>"%Temp%\AddRegNone.tmp"
          %SystemRoot%\System32\reg.exe IMPORT "%Temp%\AddRegNone.tmp" >nul 2>nul
          del "%Temp%\AddRegNone.tmp"
          
          echo Add registry values for %AppName% to registry hive %RegHive% ...
          %SystemRoot%\System32\reg.exe ADD "%RegHive%\Software\Classes\%AppName%%FileExt%" /f /ve /t REG_SZ /d "!FileType!" >nul
          if "%AddIcon%" == "1" %SystemRoot%\System32\reg.exe ADD "%RegHive%\Software\Classes\%AppName%%FileExt%\DefaultIcon" /f /ve /t REG_SZ /d "!AppFullName!,-3" >nul
          %SystemRoot%\System32\reg.exe ADD "%RegHive%\Software\Classes\%AppName%%FileExt%\shell\Open\Command" /f /ve /t REG_SZ /d "\"!AppFullName!\" \"%%1\"" >nul
          %SystemRoot%\System32\reg.exe ADD "%RegHive%\Software\Classes\%AppName%%FileExt%\shell\Print\Command" /f /ve /t REG_SZ /d "\"!AppFullName!\" /p \"%%1\"" >nul
          endlocal
          
          if /I not "%RegHive%" == "HKCU" if /I not "%RegHive%" == "HKEY_CURRENT_USER" goto EndBatch
          
          echo Add user choice registry value for file extension %FileExt% for %AppName% ...
          %SystemRoot%\System32\reg.exe ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\%FileExt%\UserChoice" /f /v "Progid" /t REG_SZ /d "%AppName%%FileExt%" >nul
          
          :EndBatch
          echo/
          endlocal
          pause
          
          There are defined the following customizable environment variables at top of this batch file:
          • FileExt with just . assigned as value to associate UltraEdit or UEStudio with files having no file extension. It is possible to use this batch file also to associate UE or UES with any file extension by modifying this variable definition. Please read the comments above set "FileExt=." for details.
          • FileType with value File with no file extension defines the description for the specified file type displayed by Windows Explorer in column Type and in Set Associations control panel dialog window in column Description with the exception of the file type for files with no file extension.
          • Program with value uedit64 defines the program file name which is in this case for 64-bit UltraEdit. The string uedit32 must be used for 32-bit UltraEdit and the string uestudio for 32-bit or 64-bit UEStudio.
          • RegHive with value HKCU defines the registry hive to add the file association. The default is the registry hive for current user which does not require elevated privileges of a local administrator. The string value can be modified to HKLM to add the file association to registry hive of local machine, i.e. for all user accounts using this machine. But in this case the batch file must be run as administrator to have the required permissions for write access to local machine registry hive.
          • AddIcon with value 0 disables adding also a default icon for this file type. This means that Windows uses an icon looking like a sheet of a notepad with blue lines, at least on Windows 7 because of registry value PerceivedType with value text added by this batch file. The value 1 results in associating icon group 3 of UltraEdit or UEStudio with the file type which contains icons looking like a sheet with UE/UES icon.
          The code of this batch file is written for execution on Windows XP and any later Windows version.

          Note: While Windows Explorer shows for files with no file extension the correct icon and the correct description as registered by the batch file, the dialog window opened with Control Panel - Default Programs - Associate a file type or protocol with a program shows (on Windows 7) a different icon and the not registered description Local Disk. This is a Windows issue as I could see with Sysinternals Process Monitor. explorer.exe does not look for default value string of UltraEdit. respectively UEStudio. on opening the Set Associations dialog window to show the correct description for files with no extension and also does not look for DefaultIcon. These two issues do not occur on registering a file extension like .xyz. Windows XP shows the icon and the file description correct on tab File Types for files with no file extension.
          Best regards from an UC/UE/UES for Windows user from Austria