0

How do I change this context menu command to open a single explorer window even if multiple files have been selected?

The code below effectively moves the files selected to a custom folder in Dropbox. However, if multiple files are selected then multiple explorer windows are opened.

I know it can be improved upon, for example, to have better handling of multiple files and to work without using cmd so there isn't a flash of a command prompt when executed - amendments are welcome.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Move to Dropbox Folder\command]
@="cmd /k \"MOVE \"%1\" \"%%USERPROFILE%%\\Dropbox\\Music\\New Music\" & explorer \"%%USERPROFILE%%\\Dropbox\\Music\\New Music\"\" & exit"

[HKEY_CLASSES_ROOT\*\shell\Move to Dropbox Folder]
"Icon"="C:\\Program Files (x86)\\Dropbox\\Client\\Dropbox.exe"

demo

2

1 Answer 1

0

For creating a custom context menu command to move audio files to a specific Dropbox folder, create the following files.

  • dropbox.reg (run this)

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\SystemFileAssociations\audio\Shell\Dropbox]
    @="Move to Dropbox Folder"
    "Icon"="C:\\Program Files (x86)\\Dropbox\\Client\\Dropbox.exe"
    
    [HKEY_CLASSES_ROOT\SystemFileAssociations\audio\Shell\Dropbox\command]
    @="C:\\Portable Apps\\Registry Hacks\\dropbox.bat \"%1\""
    
  • And then dropbox.bat (put this at C:\Portable Apps\Registry Hacks)

    @echo off
    setlocal enableextensions disabledelayedexpansion
    
    if "%~1"=="" exit /b
    
    set "targetFolder=%USERPROFILE%\Dropbox\Music\New Music"
    for %%a in (%*) do move "%%~fa" "%targetFolder%"
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .