In short: no. You have to rewrite the command, unless the specific command actually does accept multiple parameters (which may be variables). In your case it doesn't so you need to rewrite it.
One option would be to use findstr
instead of find
. You can pass multiple search patterns:
dir c:\ /s /b /a | findstr /c:"my file" /c:"other" /c:"other 2" ...
I don't know how well that scales to about "50 other things" though, but then no such solution may. Maybe you can condense the filenames to a view using regular expressions (check findstr /?
).
You could also simply do:
for /R c:\ %i in ("my file" "other" "other2") do @echo %i
Both solutions bear the option for duplicates, however. They essentially search based on a "contains" semantic. So, both "C:\foo\my file" and "C:\foo\bar\my file\something.txt" would match. But then your original solution had that issue as well.
If you can make your search patterns unique or can live with false positives, than that shouldn't be an issue. But be aware of it nevertheless.