Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
October 25, 1999
HomeCopy.bat uses only standard commands. It assumes that each user's home directory has a common parent folder, as in:
c:users
c:usersuser1
c:usersuser2
The syntax is:
HomeCopy
file1[,file2,file3,....fileN]
HomeCopy.bat contains:
@echo offif NOT {%1}
{} goto begin:syntax@echo Syntax: HomeCopy Parent_Folder File1[,file2,file3,.....filen]goto end:finishendlocalgoto end:beginsetlocalif NOT EXIST %1 goto syntaxset parent=%1set parent=%parent:"=%:loopShiftIf {%1}=={} goto finishif NOT EXIST %1 goto syntaxset filefull=%1set file=%~nx1for /f "Tokens=*" %%i in ('dir "%parent%" /B /AD') do call :parse "%%i"goto loop:parseset child=%1set child=%child:"=%if exist "%parent%%child%%file%" del /q "%parent%%child%%file%"copy %filefull% "%parent%%child%":end
You May Also Like