dimitris93
dimitris93

Reputation: 4273

Visual studio post build event command line "for" syntax

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"

Upvotes: 5

Views: 1732

Answers (1)

Patrick Hofman
Patrick Hofman

Reputation: 157098

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

for %%i in (*.dll) do move /Y "$(TargetDir)%%i" "$(TargetDir)Lib\%%i"

Upvotes: 4

Related Questions