| | |
MS Batch File Copying
![]() |
Hey everyone,
I am always having to copy DLLs from various folders for various reasons. So I thought if I had a .bat file to do it then it would save me bucket loads of time.
So is anybody here able to provide code to copy from several folders and place them into a single one?
The folders with the DLLs are along the lines of:
C:\FileManager\Implementation\bin\Debug\fileman.dll
C:\Viewer\Implementation\bin\Debug\viewer.dll
C:\Resource\Implementation\bin\Debug\resource.dll
And I would like them to be placed into a folder like:
C:\DllFiles
I have seen some code for copying files, but it just does a full copy of the folder. So is there a way to just get the specific DLLs (and not any referenced ones contained in Debug) I want instead of the other files MS Visual Studio creates in Debug?
I am always having to copy DLLs from various folders for various reasons. So I thought if I had a .bat file to do it then it would save me bucket loads of time.
So is anybody here able to provide code to copy from several folders and place them into a single one?
The folders with the DLLs are along the lines of:
C:\FileManager\Implementation\bin\Debug\fileman.dll
C:\Viewer\Implementation\bin\Debug\viewer.dll
C:\Resource\Implementation\bin\Debug\resource.dll
And I would like them to be placed into a folder like:
C:\DllFiles
I have seen some code for copying files, but it just does a full copy of the folder. So is there a way to just get the specific DLLs (and not any referenced ones contained in Debug) I want instead of the other files MS Visual Studio creates in Debug?
Sir David Healy - Northern Ireland Goal King
use copy or xcopy.
http://www.computerhope.com/xcopyhlp.htm
Is a good resource.
*.dll just copies files with the .dll extension.http://www.computerhope.com/xcopyhlp.htm
Is a good resource.
*Voted best profile in the world*
For the data set:
C:\FileManager\Implementation\bin\Debug\fileman.dll
C:\Viewer\Implementation\bin\Debug\viewer.dll
C:\Resource\Implementation\bin\Debug\resource.dll
Try something like:
Very quick and very very dirty. Need some error checking and should also put in a method to specify files from the command line or another file.
Gotchas are going to be the parenthesis and the strings to iterate through. Check out www.ss64.com/nt. Not a plug; just an excellent reference site for Windows and other OSes with command line access.
C:\FileManager\Implementation\bin\Debug\fileman.dll
C:\Viewer\Implementation\bin\Debug\viewer.dll
C:\Resource\Implementation\bin\Debug\resource.dll
Try something like:
@echo off
for /f %%G in ("FileManger","Viewer","Resource") do (
for /f %%H in ("fileman","viewer","resource") do xcopy /c /h /v /y %%G\Implementation\bin\Debug\%%H.dll
)Gotchas are going to be the parenthesis and the strings to iterate through. Check out www.ss64.com/nt. Not a plug; just an excellent reference site for Windows and other OSes with command line access.
•
•
•
•
The folders with the DLLs are along the lines of:
C:\FileManager\Implementation\bin\Debug\fileman.dll
C:\Viewer\Implementation\bin\Debug\viewer.dll
C:\Resource\Implementation\bin\Debug\resource.dll
And I would like them to be placed into a folder like:
C:\DllFiles
@echo off
copy C:\FileManager\Implementation\bin\Debug\fileman.dll C:\DllFiles\*.*
copy C:\Viewer\Implementation\bin\Debug\viewer.dll C:\DllFiles\*.*
copy C:\Resource\Implementation\bin\Debug\resource.dll C:\DllFiles\*.*
When you run this a second time you will probably be prompted to overwrite file. If you wish to avoid mess age add /Y to end of each copy line.
The echo off command just stops the command being displayed.
Have fun
Denis
![]() |
Similar Threads
- Defragmenting XP using Batch File (Windows NT / 2000 / XP)
- Adding URL's To Favourites Using A Batch File (Windows NT / 2000 / XP)
- JProgressBar while file copying (Java)
- Batch file that takes arguments (C)
- batch file help - extraction (Windows NT / 2000 / XP)
- Batch file for renaming extensions (Windows NT / 2000 / XP)
Other Threads in the Legacy and Other Languages Forum
- Previous Thread: to convert string to integer value
- Next Thread: palindrome program
| Thread Tools | Search this Thread |






