I have to mention first that I have neither UltraEdit Portable nor UltraCompare Portable and so could not test my solution with these two applications. I tested my solution with the non-portable versions UltraEdit and UltraCompare Professional.
UltraEdit detects the availability of UltraCompare Professional by existence of its
application registration. The application registration is done by the installers of UltraCompare, UltraEdit, UEStudio, ... The portable versions are used without the execution of an installer on the machine on which the USB stick with the executables is plugged in. For that reason there is no application registration done on the computer on which the portable versions are executed from the USB stick.
It is of course possible to manually do a temporary registration of UltraCompare Professional for current user only so that UltraEdit Portable recognizes UltraCompare Professional Portable. There are two batch files required both stored also on the USB stick and executed from the USB stick.
The first batch file is
RegUC.cmd with just one long command line:
Code: Select all
@%SystemRoot%\System32\reg.exe QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\uc.exe" >nul 2>nul || %SystemRoot%\System32\reg.exe ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\uc.exe" /f /ve /t REG_SZ /d "%~d0\Path\UltraCompare\ucp.exe" >nul
Please note that the part
Path\UltraCompare\ucp.exe in the command line must be adapted with correct path and file name of the executable of UltraCompare Professional Portable on the USB stick.
%~d0 references drive letter and colon of the batch file containing this line. So the drive letter assigned by Windows to the USB stick is used automatically on registering UC.
There is registered
uc.exe (non-portable UltraCompare Professional) with the fully qualified file name of UltraCompare Professional Portable as that is the registry key searched also by UltraEdit Portable according to the information provided in the first post of this topic.
This batch file first checks if there is no registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\uc.exe and if this condition is true, it adds the registry key with the default string value being the fully qualified file name of the executable of UltraCompare Professional Portable on the USB stick. If there is by chance already an application registration for UltraCompare Professional in registry hive of current user on host machine, this application registration is kept as is.
The second batch file is
UnRegUC.cmd with following command lines:
Code: Select all
@echo off
%SystemRoot%\System32\reg.exe QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\uc.exe" /ve 2>nul | %SystemRoot%\System32\find.exe /I "%~d0\Path\UltraCompare\ucp.exe" >nul || exit /B
%SystemRoot%\System32\reg.exe DELETE "HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\uc.exe" /f >nul 2>nul
for /F "delims=" %%I in ('%SystemRoot%\System32\reg.exe QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths" 2^>nul') do exit /B
%SystemRoot%\System32\reg.exe DELETE "HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths" /f >nul 2>nul
Please note that the part
Path\UltraCompare\ucp.exe in the second command line must be adapted with correct path and file name of the executable of UltraCompare Professional Portable on the USB stick.
This batch file first checks if the registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\uc.exe exists and the default string value has the string which is stored in
RegUC.cmd. Otherwise the batch file execution is exited as there is an application registration of UltraCompare on the host machine which was not done by
RegUC.cmd.
In case of UltraCompare Professional Portable on USB stick is indeed currently registered in registry hive of current user, the registry key is deleted by this batch file. There is additionally checked if there is next nothing under key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths in which case this empty registry key is also deleted to restore the initial registry data completely.
The registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths does by default not exist. Most applications are installed for all users using the special trusted installer account or an administrator account and therefore register the installed application in registry hive of local machine, i.e. under registry key
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths (64-bit applications on 64-bit Windows, 32-bit applications on 32-bit Windows) or
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths (32-bit applications on 64-bit Windows). 32-bit or 64-bit registry path does not make any difference since Windows 7 as described by the Microsoft documentation page about
Registry Keys Affected by WOW64 because of being shared between the 32-bit and 64-bit execution environments.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths is used by installers only if an application is explicitly installed for current user only which the installers of UltraEdit and UltraCompare also support.
The batch file
RegUC.cmd must be executed from the USB stick before opening in UltraEdit the
Compare Files/Folders window. The batch file
UnRegUC.cmd must be executed before plugging off the USB stick from the host machine.