Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ScribbleGhost/b4bcd27544ded9d473fe803a8d316fcf to your computer and use it in GitHub Desktop.
Save ScribbleGhost/b4bcd27544ded9d473fe803a8d316fcf to your computer and use it in GitHub Desktop.
Add batch file to the context menu - Process all files in folder

Add batch file to the context menu - Process all files in folder

This gist allows you to add a batch script to the Windows context menu (right click menu). This batch file is just a dummy-file. It doesn't do anything other than list all the files in a folder, so don't get nervous 😉.

  • Add the batch file to C:\Scripts\
  • Run Add Process all files in folder to the context menu.reg
  • Right click on a folder to see the new option "Process all files in folder"
  • Run the script to process all files in folder
  • To remove the script just delete the batch file and run "Remove Process all files in folder from the context menu.reg"
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\Process all files in folder]
@="&Process all files in folder"
[HKEY_CLASSES_ROOT\Directory\shell\Process all files in folder\command]
@="\"C:\\Scripts\\Process all files in folder.bat\" \"%1\""
@echo off
cd %1
for /r %%i in (*) do (echo "%%i")
pause
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\shell\Process all files in folder]
@="&Process all files in folder"
[-HKEY_CLASSES_ROOT\Directory\shell\Process all files in folder\command]
@="\"C:\\Scripts\\Process all files in folder.bat\" \"%1\""
@OmnyH
Copy link

OmnyH commented Mar 4, 2023

Your very simple script helped me to create mine to add a "Catalog with Cathy" context menu.
The cathycmd utility requires a text file containing the path of the folder to process.

Cathy.bat:
@echo off
cd %1
chcp 1252>nul
for %%# in (%1) do (echo #DEV %%~# > D:\Documents\Cathy\Cathy.conf
D:\Documents\Cathy\CathyCmd.exe -f D:\Documents\Cathy\Cathy.conf
)
Pause

Copypath.reg:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\CopyPath]
@="Cataloguer avec Cathy"
"Icon"=""C:\Program Files (x86)\rOva\Cathy.exe""

[HKEY_CLASSES_ROOT\Directory\shell\CopyPath\command]
@=""D:\Documents\Cathy\Cathy.bat" "%1""

THANK YOU !

@sean1832
Copy link

sean1832 commented Apr 2, 2023

If I select multiple files and run the bat file, the bat file runs seperately for all selected files. Is there's a way to run it once and process all selected files?

@natemac
Copy link

natemac commented Sep 19, 2023

If I select multiple files and run the bat file, the bat file runs seperately for all selected files. Is there's a way to run it once and process all selected files?
@sean1832
did you ever find a solution to this? run with all files selected?

@sean1832
Copy link

If I select multiple files and run the bat file, the bat file runs seperately for all selected files. Is there's a way to run it once and process all selected files?
@sean1832
did you ever find a solution to this? run with all files selected?

I still have no idea man, sorry. Do post it here if you ever find a solution. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment