Useful batch commands in pre-build and post-build steps of Visual Studio projects

I found that these two small commands are often very helpful when you write pre-build or post-build steps for your Visual Studio projects:

for /d %%f in ("path\*") do ...
xcopy /y "path\*.*" "anotherpath\"

And of course, their power comes when you combine them, why not, even with multiple for levels and using & operator to run multiple commands in a single line:

for /d %%p in ("path\*") do for /d %%s in ("%%p\*") do cd "%%s" & for /d %%f in (*) do xcopy /y "$(ProjectDir)\common\*.*" "%%f\"
Advertisements

About Sorin Dolha

My passion is software development, but I also like physics.
This entry was posted in Development and tagged , , , , . Bookmark the permalink.

Add a reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s