OSDN Git Service

ShellExtension: Add [Un]RegisterPerUser.bat
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 19 May 2019 01:48:49 +0000 (10:48 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 19 May 2019 01:48:49 +0000 (10:48 +0900)
BuildArc.cmd
ShellExtension/RegisterPerUser.bat [new file with mode: 0644]
ShellExtension/UnRegisterPerUser.bat [new file with mode: 0644]

index b3e3393..e847514 100644 (file)
@@ -63,7 +63,7 @@ if not "%1" == "" (
 rem ShellExtension
 copy "Build\ShellExtension\ShellExtensionU.dll" "%DISTDIR%\%PLATFORMH%zip-version\WinMerge\"
 copy "Build\ShellExtension\ShellExtensionX64.dll" "%DISTDIR%\%PLATFORMH%zip-version\WinMerge\"
-copy ShellExtension\*Register.bat "%DISTDIR%\%PLATFORMH%zip-version\WinMerge\"
+copy ShellExtension\*Register*.bat "%DISTDIR%\%PLATFORMH%zip-version\WinMerge\"
 
 rem Translation
 copy Build\%PLATFORM%\MergeUnicodeRelease\Languages\*.po "%DISTDIR%\%PLATFORMH%zip-version\WinMerge\Languages\"
diff --git a/ShellExtension/RegisterPerUser.bat b/ShellExtension/RegisterPerUser.bat
new file mode 100644 (file)
index 0000000..d88dbc3
--- /dev/null
@@ -0,0 +1,32 @@
+@echo off
+: RegisterPerUser.bat
+:
+: ShellExtension.dll is a so called 'Shell Extension'
+: allowing user to start WinMerge from explorer's context
+: menu to compare selected files/directories.
+: However this dll file must be registered for
+: Windows before it works.
+:
+: ShellExtension.dll can be unregistered with command:
+: "RegisterPerUser.bat /U"
+
+IF "%OS%" == ""                          Set DLLPATH=%0\..\ShellExtension.dll
+IF "%PROCESSOR_ARCHITECTURE%" == "x86"   Set DLLPATH=%~dp0%ShellExtensionU.dll
+IF "%PROCESSOR_ARCHITECTURE%" == "AMD64" Set DLLPATH=%~dp0%ShellExtensionX64.dll
+IF "%PROCESSOR_ARCHITECTURE%" == "IA64"  Set DLLPATH=%~dp0%ShellExtensionX64.dll
+
+IF "%1" == "/u" Goto Uninstall
+IF "%1" == "/U" Goto Uninstall
+
+Echo Registering ShellExtension.dll for current user only...
+%WINDIR%\System32\RegSvr32 /n /i:user "%DLLPATH%"
+IF EXIST "%~dp0\WinMerge32BitPluginProxy.exe" "%~dp0\WinMerge32BitPluginProxy.exe" /RegServerPerUser
+Goto End
+
+:Uninstall
+Echo UnRegistering ShellExtension.dll for current user only...
+%WINDIR%\System32\RegSvr32 /u /n /i:user "%DLLPATH%"
+IF EXIST "%~dp0\WinMerge32BitPluginProxy.exe" "%~dp0\WinMerge32BitPluginProxy.exe" /UnregServerPerUser
+Goto End
+
+:End
diff --git a/ShellExtension/UnRegisterPerUser.bat b/ShellExtension/UnRegisterPerUser.bat
new file mode 100644 (file)
index 0000000..9136c35
--- /dev/null
@@ -0,0 +1 @@
+%0\..\RegisterPerUser.bat /u