Use batch file to copy 1 file to N folders

September 21, 2010 at 08:58:03
Specs: Windows XP
Is it possible to do something like this in a bat file???

copy "C:\config.ini" dir C:\documents and settings "\Application Data\Intel\Wireless\Settings"

I need to copy this file to each computer user's application data folder.

Thanks,


See More: Use batch file to copy 1 file to N folders

Report •


#1
September 22, 2010 at 09:51:01
Hi brumshine,

Try this;

::SCRIPT STARTS HERE

@echo off
set FILE_TO_BE_COPIED=C:\config.ini

set LOCATION1=C:\"Documents and Settings"\User1\"Application Data"\Intel\Wireless\Settings

set LOCATION2=C:\"Documents and Settings"\User2\"Application Data"\Intel\Wireless\Settings

copy %FILE_TO_BE_COPIED% %LOCATION1%
copy %FILE_TO_BE_COPIED% %LOCATION2%

pause
exit

::SCRIPT ENDS HERE

I hope I did helped you.

Kind Regards,

MUs


Report •

#2
September 22, 2010 at 10:13:54
This should cycle through the users in your C:\documents and settings folder and copy the file to the folder in each user's folder. If you have Windows Vista or 7 computers in the mix, this will need to be revised (let me know, we can make that work as well)



cd %systemdrive%\Documents and Settings
for /f %%a in ('dir /b') do (
copy c:\config.ini "C:\documents and settings\%%a\Application Data\Intel\Wireless\Settings"
)



Report •

#3
November 17, 2010 at 13:23:31
Viddy,
I have a question. I like to copy a file to a folder if part of a file name the same as folder. The compapy we work with, has a zip file and in the zip file we have about 100 files, each file contains a 4 digits # belong to that person, I like to be able to move or copy this file to the same 4 digits # folder. Is it possible?

Report •

Related Solutions


Ask Question