5

Solution1 : { Project1 (windows form), Project2 (class library) }

Trying to copy all .dll(s) I get from after compiling Project1, from the default directory (same as the .exe) to a /lib sub-folder.

if not exist Lib mkdir Lib
for %i in (*.dll) move /Y "$(TargetDir)%i" "$(TargetDir)Lib\%i"

I have problem with the for %i in (*.dll) syntax. What is the correct way of doing it?

Note: This would give no errors (but would copy only 1 .dll, not all):

if not exist Lib mkdir Lib
move /Y "$(TargetDir)first.dll" "$(TargetDir)Lib\first.dll"
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
dimitris93
  • 4,155
  • 11
  • 50
  • 86

1 Answers1

4

You were almost there. You should use a double percentage %% and do:

for %%i in (*.dll) do move /Y "$(TargetDir)%%i" "$(TargetDir)Lib\%%i"
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
  • 1
    thanks a lot, I tried with double `%` before, but I forgot to use double `%` in the later part of the command. The error I got wasn't too descriptive – dimitris93 May 19 '15 at 07:49