- 1 year ago
How to invoke a verb on multiple files
To invoke a verb on multiple files in Windows, you can use a command-line utility called forfiles
. forfiles
allows you to execute a command on multiple files that match a specified criteria.
Here's an example command to invoke a verb (e.g., open, print, edit) on multiple files using forfiles
:
swiftforfiles /P "path_to_files" /M "file_pattern" /C "cmd /c start \"\" /D \"%%~dpI\" \"%%I\""
Replace path_to_files
with the path to the directory containing the files you want to apply the verb to, and file_pattern
with the pattern to match the files (e.g., "*.txt" for all text files).
The /C
option specifies the command to execute on each file. In this case, it uses cmd /c start
to open the file with the associated application, using the specified verb.
Make sure to enclose the entire command in double quotes and escape the inner double quotes with backslashes (\"
), as shown in the example.
Note that forfiles
is available on Windows Vista and later versions.