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.
Thanks.
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