From 673a1a33f768c17ee4dfb1c6c8fd527d03113e17 Mon Sep 17 00:00:00 2001 From: GChuf Date: Fri, 26 Nov 2021 23:45:41 +0100 Subject: [PATCH] Add old context menu option for Windows 11 --- RCWM/files/RCopy.reg | 42 +++++++++---------- RCWM/files/Win11AddOldContextMenu.reg | 11 +++++ RCWM/install.cmd | 25 ++++++++--- .../Win11RevertToDefaultContextMenu.reg | 7 ++++ 4 files changed, 59 insertions(+), 26 deletions(-) mode change 100755 => 100644 RCWM/files/RCopy.reg create mode 100644 RCWM/files/Win11AddOldContextMenu.reg create mode 100644 RCWM/uninstall/Win11RevertToDefaultContextMenu.reg diff --git a/RCWM/files/RCopy.reg b/RCWM/files/RCopy.reg old mode 100755 new mode 100644 index 1d6099a..bbd5479 --- a/RCWM/files/RCopy.reg +++ b/RCWM/files/RCopy.reg @@ -1,21 +1,21 @@ -Windows Registry Editor Version 5.00 - -;robocopy - -[HKEY_CLASSES_ROOT\Directory\shell\rcopy] -@="RoboCopy Directory" -"NoWorkingDirectory"="" -"Icon"="rcwmimg.dll,-5" - -[HKEY_CLASSES_ROOT\Directory\shell\rcopy\command] -@="cmd.exe /c echo \"%1\">C:\\Windows\\System32\\RCWM\\rc.log" -"IsolatedCommand"="cmd.exe /c echo \"%1\">C:\\Windows\\System32\\RCWM\\rc.log" - -[HKEY_CLASSES_ROOT\Directory\Background\shell\rpaste] -@="RoboPaste Directory" -"Icon"="rcwmimg.dll,-6" -[HKEY_CLASSES_ROOT\Directory\Background\shell\rpaste\command] -@="cmd.exe /c C:\\Windows\\System32\\RCWM\\Rcopy.bat" - - -; end +Windows Registry Editor Version 5.00 + +;robocopy + +[HKEY_CLASSES_ROOT\Directory\shell\rcopy] +@="RoboCopy Directory" +"NoWorkingDirectory"="" +"Icon"="rcwmimg.dll,-5" + +[HKEY_CLASSES_ROOT\Directory\shell\rcopy\command] +@="cmd.exe /c echo \"%1\">C:\\Windows\\System32\\RCWM\\rc.log" +"IsolatedCommand"="cmd.exe /c echo \"%1\">C:\\Windows\\System32\\RCWM\\rc.log" + +[HKEY_CLASSES_ROOT\Directory\Background\shell\rpaste] +@="RoboPaste Directory" +"Icon"="rcwmimg.dll,-6" +[HKEY_CLASSES_ROOT\Directory\Background\shell\rpaste\command] +@="cmd.exe /c C:\\Windows\\System32\\RCWM\\Rcopy.bat" + + +; end \ No newline at end of file diff --git a/RCWM/files/Win11AddOldContextMenu.reg b/RCWM/files/Win11AddOldContextMenu.reg new file mode 100644 index 0000000..9776f15 --- /dev/null +++ b/RCWM/files/Win11AddOldContextMenu.reg @@ -0,0 +1,11 @@ +Windows Registry Editor Version 5.00 + +;Add old context manu + +[HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}] +@="" + +[HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32] +@="" + +;done \ No newline at end of file diff --git a/RCWM/install.cmd b/RCWM/install.cmd index 9268ed9..fa25930 100644 --- a/RCWM/install.cmd +++ b/RCWM/install.cmd @@ -2,6 +2,9 @@ title RCWM Install Script color 3 +rem https://stackoverflow.com/questions/8610597/batch-file-choice-commands-errorlevel-returns-0 +SETLOCAL EnableDelayedExpansion + REM Get Admin Privileges REM Taken from: https://stackoverflow.com/questions/11525056/how-to-create-a-batch-file-to-run-cmd-as-administrator @@ -25,7 +28,7 @@ echo( echo ********************************* echo ****** RCWM Install Script ****** echo ********************************* -echo ************************v1.3***** +echo ************************v1.4***** echo * https://github.com/GChuf/RCWM * echo ********************************* echo( @@ -35,9 +38,7 @@ echo( cd files rem powershell version check -FOR /F "tokens=* USEBACKQ" %%F IN (`powershell $psversiontable.psversion.major`) DO ( -SET pwsh=%%F -) +FOR /F "tokens=* USEBACKQ" %%F IN (`powershell $psversiontable.psversion.major`) DO ( SET pwsh=%%F ) IF %pwsh% LSS 5 ( IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" ( echo Using powershell version older than 5 on 32bit CPU. ) else ( echo Using powershell version older than 5 on 64bit CPU. ) @@ -49,7 +50,7 @@ IF %pwsh% LSS 5 ( powershell "echo '$n = -join ((0,1,2,3,4,5,6,7,8,9,\"a\",\"b\",\"c\",\"d\",\"e\",\"f\")|get-random -count 6)' | Out-File mvdir.ps1" powershell "echo '(get-location).path|out-file C:\windows\system32\rcwm\mv\$n -encoding UTF8'|Out-File mvdir.ps1 -Append" - ) ELSE ( +) ELSE ( IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" ( echo Using powershell version 5 or newer on 32bit CPU. ) else ( echo Using powershell version 5 or newer on 64bit CPU. ) ) @@ -73,6 +74,20 @@ echo Choose the options that you want to apply to your right-click menu. echo You will be asked separately for each option (divided into Add and Remove sections). echo( + +FOR /F "tokens=*" %%g IN ('powershell "([Environment]::OSVersion).Version.Major"') do (SET WinVer=%%g) +echo( + +IF %WinVer% == 11 ( + choice /C yn /M "Do you want to enable old context menu in Windows 11 " + if !errorlevel! == 1 ( + start /w regedit /s Win11AddOldContextMenu.reg + ) +) + +echo( +color c + choice /C yn /M "Do you want to Add right-click menu options " if %errorlevel% == 1 ( goto Add ) else ( goto RemoveOptions ) diff --git a/RCWM/uninstall/Win11RevertToDefaultContextMenu.reg b/RCWM/uninstall/Win11RevertToDefaultContextMenu.reg new file mode 100644 index 0000000..6f9952f --- /dev/null +++ b/RCWM/uninstall/Win11RevertToDefaultContextMenu.reg @@ -0,0 +1,7 @@ +Windows Registry Editor Version 5.00 + +;revert back to Win11 default context menu + +[-HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}] + +;done \ No newline at end of file