Windows Explorer Integration

Hi

Just installed the desktop client. this is the other issue i’m having

I dont see any context menu in Windows Explorer to show that i can sync a particular folder to nextcloud even though i chose it during install

1 Like

Have you tried rebooting yet? Sometimes it takes a reboot, or at least restarting Windows Explorer for the shell extensions to start working. I actually made a script which can force this to update without rebooting, comes in handy sometimes.

Two files, fixShellExtensions.cmd and helper_registerDLLs.cmd. You just run fixShellExtensions.cmd and it will automatically ask for elevated privileges, then at the end you just exit out of the cmd prompt and it restarts Windows Explorer and shell extensions should now work (unless you have Dropbox installed, sometimes those sync icons don’t work).

fixShellExtensions.cmd:

@echo off

:: Register DLL files
start /wait %~dp0\helper_registerDLLs.cmd

:: Restart explorer
taskkill /f /im explorer.exe
start explorer.exe

helper_registerDLLs.cmd:

::::::::::::::::::::::::::::::::::::::::::::
:: Elevate.cmd - Version 4
:: Automatically check & get admin rights
::::::::::::::::::::::::::::::::::::::::::::
 @echo off
 CLS
 ECHO.
 ECHO =============================
 ECHO Running Admin shell
 ECHO =============================

:init
 setlocal DisableDelayedExpansion
 set cmdInvoke=1
 set winSysFolder=System32
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion

:checkPrivileges
  NET FILE 1>NUL 2>NUL
  if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

:getPrivileges
  if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
  ECHO.
  ECHO **************************************
  ECHO Invoking UAC for Privilege Escalation
  ECHO **************************************

  ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
  ECHO args = "ELEV " >> "%vbsGetPrivileges%"
  ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
  ECHO args = args ^& strArg ^& " "  >> "%vbsGetPrivileges%"
  ECHO Next >> "%vbsGetPrivileges%"

  if '%cmdInvoke%'=='1' goto InvokeCmd 

  ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
  goto ExecElevation

:InvokeCmd
  ECHO args = "/c """ + "!batchPath!" + """ " + args >> "%vbsGetPrivileges%"
  ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas", 1 >> "%vbsGetPrivileges%"

:ExecElevation
 "%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %*
 exit /B

:gotPrivileges
 setlocal & cd /d %~dp0
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul  &  shift /1)

 ::::::::::::::::::::::::::::
 ::START
 ::::::::::::::::::::::::::::
 REM Run shell as admin (example) - put here code as you like
 regsvr32.exe "C:\Program Files (x86)\Nextcloud\shellext\OCContextMenu_x64.dll"
 regsvr32.exe "C:\Program Files (x86)\Nextcloud\shellext\OCOverlays_x64.dll"
2 Likes

thank you. this worked for me

awesome, this worked for me too!

thanks a lot!

I had the same problem and your scripts solved it, linucksrox! Thank you so much! :ok_hand: :ok_hand: :ok_hand:

Hi linucksrox.

I have the same problem with the Windows Client Version 2.5.1final (build 20181204)

I have a german Windows 10 1809 and my user has the local Administrator rights.

When I run your script from “C:\NextCloudFix\fixShellExtensions.cmd” in CMD or PowerShell (as Administrator). I get the Windows dialog:

Error loading the module “C:\Program Files (x86)\Nextcloud\shellext\OCContextMenu_x64.dll”
Make sure that the binary file is located in the path or debug the file to avoid the problems with the binary file or dependent DLL files.
The module was not found.

Screenshot%20Nextcloud%2002

The DLL files are located in the path:

Screenshot%20Nextcloud%2003

Is there maybe another way to register the DLLs?

Ultimately you just need to run the regsvr32 command as an administrator. In order to confirm you have the correct path, I would browse to the .dll file, hold shift and right click on the file, then click “Copy as path.” Then open cmd as administrator and run regsvr32.exe [paste path here]
You would also do that for the OCOverlays file and I guess it wouldn’t hurt to try with the OCUtil file as well.

Hi guys.

I have solved it! :metal: :metal: :metal:

My Windows is 10 1809 x64
In the C:\Program Files (x86)\Nextcloud (not in shellext) there are also the same DLL but without x64.

Screenshot%20Nextcloud%2005

I was able to register then:

Now I have the green checks and the context menu.

Thanks linucksrox for the idea.

Huh!?! There is a way to refresh just a single file/folder in the menu when right clicking??? I only have share options. How do I enable this feature? Thank you

I’m not sure I understand the question. What are you trying to do exactly?

Yes the icon already is indicated with a green arrow that is has been synced. When you right click on a file/folder that is synced with Nextcloud, in the menu that appears there is a Nextcloud submenu, the only options I have are Share, Copy Private link…, and Send private link…, is there an option to download, sync, etc, just that file/folder? As stated “I dont see any context menu in Windows Explorer to show that i can sync a particular folder to nextcloud” = As shown in this image: Right Click Menu

Ok, I think I get what you’re asking. Yes, there is a way to just sync a specific folder, but that’s not done by right clicking. You need to open the Nextcloud application settings and choose what to sync. Start by making sure you’re not syncing everything for the account, and then click the Add Folder Sync Connection to choose which local folder you want to sync with which remote folder. You can do as many connections as you want. Here’s what one of my accounts looks like:

Oh…I thought one could do this via “Windows Explorer” as stated above, to refresh/update only the file/folder.

Adding a folder for syncing via the client, I already know.

I can’t understand why you would want to manually sync a folder when the client handles this automatically in almost real time, unless I’m missing the point of what you’re trying to do. What would be the use case for manually refreshing a specific folder from Windows explorer?

Hi, new to Nextcloud but migrating from ownCloud - would running both clients i.e. NC and OC have them interfere with each other for the Explorer integration? I’m only doing it while I test the migration so I will remove one of them, but I get the feeling that I’m not seeing the NC menu or icons because OC is present as its context menu does appear.

They should not interfere if you don’t run them on the same folders locally. However, you may be able to use one client and connect to both the ownCloud and Nextcloud instances as two different accounts.
Regarding the icons, if you are using Windows there is a known limitation (Windows issue, not anything to do with ownCloud or Nextcloud). Windows only allows a limited number of overall overlay icons, so if you use two different clients, and possibly dropbox or something else, they all get used up meaning the last client to get installed doesn’t get to display their icons.

1 Like

Thanks for the explanation. Yeah, both are syncing different folders so I’m sure there is no problem there, it’s just with the context menu/icons that I see a problem. I’ll just have to wait and see what happens when I eventually remove the OC cliient.