Use: Command-Queuer.cmd
I wanted to do the same thing and ended up creating a 'wrapper' .cmd/bat file to queue the commands for me... I use a temporary queue file to: (a) self-nominate a control instance to run the process, and (b) signal to other instances not run the command(s) directly and instead just add their file/parameters to the queue and exit. The script waits X seconds for the other instances to queue their info and then processes the selected files sequentially.
Command-Queuer.cmd
------------------
@ECHO OFF
SETLOCAL
:: SETUP PARAMETERS: Control temp file location and delay before running
SET QueueFile="%TEMP%\Multi-Item-Queue.txt"
SET /A Secs=5
:: MAIN PROGRAM: If the first instance create the queue and wait, otherwise transfer to queue and exit
IF EXIST %QueueFile% ( ECHO %* >> %QueueFile% ) ELSE (
ECHO %* > %QueueFile%
ECHO Waiting %Secs% seconds for other files to finish queuing then will activate...
TIMEOUT /T %Secs% /NOBREAK >nul
REM - ADD YOUR CODE HERE TO PROCESS THE QUEUE FILE AS A WHOLE
REM - Example: Display popup of all file paths selected: Msg %username% <%QueueFile%
REM - ALTERNATIVELY, ITERATE THROUGH EACH LINE OF THE FILE
REM - Example: FOR /F "tokens=*" %%Z in (%QueueFile%) DO ( COPY %%Z "C:\Backup" )
:: Delete the queue file when finished
DEL %QueueFile%
)
GOTO:EOF
NOTE: You will see a empty cmd window appear for a split-second for each file selected, i.e. if you select 30 files then 30 cmd windows will briefly appear, but these can be hidden if desired please check: Run a batch file in a completely hidden way (superuser.com)
HKEY_CLASSES_ROOT\*\shell
). The item shows up when I right-click on a file. When I select multiple files and then right-click, it doesn't show up. How do I fix that? – Bourbonism