简体   繁体   中英

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"

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM