A few years ago I automated account creation for an organization. Here is one of the scripts I sill use today.
echo off
REM Student extract processing script
REM
REM Finds the adds and deletes from the sasi export files
REM and saves them to adds.txt and dels.txt
REM
REM Alex trusler
REM
REM Please verify the GnuWin32 bin dir including CoreUtils,
REM DiffUtils, and Grep is in your path before executing script.
REM These tools are available at
REM gnuwin32.sourceforge.net
REM ——————————————————-
REM if %2 is NULL then display usage
if exist %2 goto else
echo —
echo —
echo usage: %0 [file1 old] [file2 new]
echo —
echo This script will save the output files
echo in your WORKING directory so change your directory
echo to your target directory.
echo —
echo Also, you can drag the batch file to the command window,
echo Then type a [space], then drag the old Stufile, [space]
echo then drage the new Stufile. Saves a lot of typing.
echo —
echo Please verify the GnuWin32 bin dir including CoreUtils,
echo DiffUtils, and Grep is in your path before executing script.
echo These tools are available at
echo gnuwin32.sourceforge.net
pause
goto eof
:else
REM compair the file from the last import to the current file.
sort %1 > temps1
sort %2 > temps2
diff –ignore-case temps1 temps2 > tempdiff
REM format and save the output
grep “> ” tempdiff | cut -b 3-100 > adds.txt
REM Cut the first 16 lines to match only the site and stu ID.
cut -b 1-16 temps1 > temps3
cut -b 1-16 temps2 > temps4
diff –ignore-case temps3 temps4 > tempdiff
REM format and save the output
grep “< ” tempdiff | cut -b 3-100 > dels.txt
REM clean up our garbage
del tempdiff
del temps1
del temps2
del temps3
del temps4
REM Tell the user the script has finished
echo Files adds.txt and dels.txt saved.
:eof