How to remove file association for batch files being opened in UltraEdit instead of executed by cmd.exe in Windows 10?

How to remove file association for batch files being opened in UltraEdit instead of executed by cmd.exe in Windows 10?

1
NewbieNewbie
1

    Dec 07, 2017#1

    On Windows 10 - 1709 UltraEdit Text/Hex Editor (x64) 

    Version 24.20.0.44

    I never had this come up before. A new HP laptop uses a .bat file to check for updates. The bat file opens in UltraEdit and I don't know if it really runs.
    I have tried to change the .bat file association, but still opens in UE. Windows 10 really screws changing associations and a search of the net really doesn't help.

    Thanks, Ken
    Ken

    6,615550
    Grand MasterGrand Master
    6,615550

      Dec 08, 2017#2

      UltraEdit v24.20.0.44 has after opening Advanced - Settings or Configuration - File associations just a button System File Associations. After clicking on this button the Windows file association configuration dialog opens. There can be configured which application to use to open a file. But this Windows configuration dialog is not really good for files with extension .bat and .cmd because after a user choice was made once with selecting an application, it is only possible to choose a different application, but not remove the file association with an application.

      So I suggest to open a command prompt window and run the following 8 commands:

      Code: Select all

      reg delete "HKEY_CURRENT_USER\Software\Classes\.bat" /f
      reg delete "HKEY_CURRENT_USER\Software\Classes\.cmd" /f
      reg delete "HKEY_CURRENT_USER\Software\Classes\UltraEdit.bat" /f
      reg delete "HKEY_CURRENT_USER\Software\Classes\UltraEdit.cmd" /f
      reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat\OpenWithList" /f
      reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.cmd\OpenWithList" /f
      reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat\UserChoice" /f
      reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.cmd\UserChoice" /f
      
      Those 8 commands to delete registry keys remove all file associations made by current user either in the Windows file association configuration dialog or with an older version of UltraEdit which has the ability to directly change a file association from within UltraEdit with the additional feature to be able to undo that change also from within UltraEdit and restore previous file association if there was one at all.

      It is possible that on execution of the commands some output the error message:

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

      Please ignore those errors as a key to delete not existing is in real no error, but the expected result after execution.

      Problematic would be only the error message:

      ERROR: Access is denied.

      In this case it would be necessary to start regedit.exe which requires elevation to administrator and delete the appropriate key manually with Windows Registry Editor.

      The deletion of the 8 registry keys in HKEY_CURRENT_USER could be also done with a registry import file which just deletes those 8 keys with
      • copying the lines below into a new ANSI encoded file,
      • save it for example with name DeleteUserBatchFileAssociations.reg,
      • double click on this registry import file,
      • confirm elevation to administrator and
      • confirm successful "import" which in real just deleted registry keys.

      Code: Select all

      REGEDIT4
      
      [-HKEY_CURRENT_USER\Software\Classes\.bat]
      
      [-HKEY_CURRENT_USER\Software\Classes\.cmd]
      
      [-HKEY_CURRENT_USER\Software\Classes\UltraEdit.bat]
      
      [-HKEY_CURRENT_USER\Software\Classes\UltraEdit.cmd]
      
      [-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat\UserChoice]
      
      [-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.cmd\UserChoice]
      
      [-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat\OpenWithList]
      
      [-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.cmd\OpenWithList]
      
      But I recommend executing the 8 reg commands as posted above because no elevation to local administrator is needed with this method while using a registry import file and regedit for deleting the keys requires elevation to administrator level.

      Here is additionally an export of HKEY_LOCAL_MACHINE\Software\Classes registry keys with the default configuration for .bat and .cmd file associations for Windows Vista and later Windows versions for completeness which a user can overload with the keys in HKEY_CURRENT_USER\Software\Classes.

      Code: Select all

      REGEDIT4
      
      [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.bat]
      
      [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.cmd]
      
      [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile]
      
      [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile]
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.bat]
      @="batfile"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.bat\PersistentHandler]
      @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.cmd]
      @="cmdfile"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.cmd\PersistentHandler]
      @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile]
      @="Windows Batch File"
      "EditFlags"=hex:30,04,00,00
      "FriendlyTypeName"=hex(2):40,25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,\
        74,65,6d,33,32,5c,61,63,70,70,61,67,65,2e,64,6c,6c,2c,2d,36,30,30,32,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\DefaultIcon]
      @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,69,\
        6d,61,67,65,72,65,73,2e,64,6c,6c,2c,2d,36,38,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell]
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\edit]
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\edit\command]
      @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,4e,\
        4f,54,45,50,41,44,2e,45,58,45,20,25,31,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\open]
      "EditFlags"=hex:00,00,00,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\open\command]
      @="\"%1\" %*"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\print]
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\print\command]
      @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,4e,\
        4f,54,45,50,41,44,2e,45,58,45,20,2f,70,20,25,31,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\runas]
      "HasLUAShield"=""
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\runas\command]
      @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,63,\
        6d,64,2e,65,78,65,20,2f,43,20,22,25,31,22,20,25,2a,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\runasuser]
      @="@shell32.dll,-50944"
      "Extended"=""
      "SuppressionPolicyEx"="{F211AA05-D4DF-4370-A2A0-9F19C09756A7}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\runasuser\command]
      "DelegateExecute"="{ea72d00e-4960-42fa-ba92-7792a7944c1d}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\ShellEx]
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\ShellEx\ContextMenuHandlers]
      @="Compatibility"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\ShellEx\ContextMenuHandlers\Compatibility]
      @="{1d27f844-3a1f-4410-85ac-14651078412d}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\ShellEx\DropHandler]
      @="{86C86720-42A0-1069-A2E8-08002B30309D}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\ShellEx\PropertySheetHandlers]
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\ShellEx\PropertySheetHandlers\ShimLayer Property Page]
      @="{513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
      @="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile]
      @="Windows Command Script"
      "EditFlags"=hex:30,04,00,00
      "FriendlyTypeName"=hex(2):40,25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,\
        74,65,6d,33,32,5c,61,63,70,70,61,67,65,2e,64,6c,6c,2c,2d,36,30,30,33,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\DefaultIcon]
      @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,69,\
        6d,61,67,65,72,65,73,2e,64,6c,6c,2c,2d,36,38,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\shell]
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\shell\edit]
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\shell\edit\command]
      @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,4e,\
        4f,54,45,50,41,44,2e,45,58,45,20,25,31,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\shell\open]
      "EditFlags"=hex:00,00,00,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\shell\open\command]
      @="\"%1\" %*"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\shell\print]
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\shell\print\command]
      @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,4e,\
        4f,54,45,50,41,44,2e,45,58,45,20,2f,70,20,25,31,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\shell\runas]
      "HasLUAShield"=""
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\shell\runas\command]
      @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,53,79,73,74,65,6d,33,32,5c,63,\
        6d,64,2e,65,78,65,20,2f,43,20,22,25,31,22,20,25,2a,00
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\shell\runasuser]
      @="@shell32.dll,-50944"
      "Extended"=""
      "SuppressionPolicyEx"="{F211AA05-D4DF-4370-A2A0-9F19C09756A7}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\shell\runasuser\command]
      "DelegateExecute"="{ea72d00e-4960-42fa-ba92-7792a7944c1d}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\ShellEx]
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\ShellEx\ContextMenuHandlers]
      @="Compatibility"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\ShellEx\ContextMenuHandlers\Compatibility]
      @="{1d27f844-3a1f-4410-85ac-14651078412d}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\ShellEx\DropHandler]
      @="{86C86720-42A0-1069-A2E8-08002B30309D}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\ShellEx\PropertySheetHandlers]
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\ShellEx\PropertySheetHandlers\ShimLayer Property Page]
      @="{513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}"
      
      [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cmdfile\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
      @="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"
      
      These lines can be copied into a new ANSI encoded text file saved for example as DefaultBatchFileAssociations.reg. With a double click on this registry import file and confirming to do that import with elevation to administrator level, the original file associations for .bat and .cmd can be restored by any user with permissions to elevate to local administrator. But this should not be necessary in your case.

      It is possible to start regedit, browse to key HKEY_LOCAL_MACHINE\Software\Classes\batfile\shell\edit\command and replace %SystemRoot%\System32\NOTEPAD.EXE %1 by "%ProgramFiles%\IDM Computer Solutions\UltraEdit\uedit64.exe" %1 (64-bit UltraEdit with default installation path) and the same for edit of cmdfile to be able to right click on a .bat or .cmd file and click in context menu on Edit to open the batch file in UltraEdit for editing.
      Best regards from an UC/UE/UES for Windows user from Austria