How to Add Files to Many Users' Home Directories
To add files to many users' home directories, perform the following steps:- Create the Addfile.bat and Addfile2.bat files listed below.
- Run Addfile.bat <Parent Directory> <File to Add> with administrative privileges from a computer running Windows NT. The Addfile.bat file simply issues a DIR command and redirects the output to a file, which in turn gets parsed using the FOR command (part of Windows NT command extensions). The Addfile2.bat file gets called once for each directory name listed in the Dir.txt file. The Addfile2.bat file issues a copy command to copy the file to each user directories.
v
echo off
cls
IF (%1)==() GOTO NoParams
IF (%2)==() GOTO NoParams
Echo Creating directory listing...
dir %1 > dir.txt
for /F "skip=7 tokens=4" %%a in (dir.txt) do call addfile2.bat %%a
%1 %2
echo ---------
echo - Done! -
echo ---------
GOTO Bottom
:NoParams
ECHO usage: ADDFILE [Parent Directory] [File to Add]
ECHO.
ECHO i.e.- ADDFILE C:\PROFILES MyFile.lnk
ECHO.
:Bottom
Filename: ADDFILE2.BAT
if (%1)==() goto bottom
if (%1)==(bytes) goto bottom
copy %3 %2\%1
:bottom
No comments:
Post a Comment