0

I need to run a command on multiple files from all subdirectories. The command for one file is like this:

AutoReplace ..\src\Path\To\AssemblyInfo.cs copyright year=2016

This will process the specified file and update certain data in it. Now I want to make it automatic so that it finds its files on its own. Here's what I tried:

for /f %a in ('dir /s /b ..\src\AssemblyInfo.cs') do AutoReplace %~fa copyright year=2016

When I type it directly in a CMD window, it works. I can see all commands for the files being printed and the files are updated as expected. But when I save this command in a file like update_copyright_year.cmd, it says this when I call it:

D:\build>update_copyright_year.cmd
"copyright" kann syntaktisch an dieser Stelle nicht verarbeitet werden.

D:\build>for /f ~fa copyright year=2016

D:\build>

Some kind of syntax error at the word "copyright" which is just another argument to the program AutoReplace. What's wrong here?

Community
  • 1
  • 1
ygoe
  • 18,655
  • 23
  • 113
  • 210

0 Answers0