Subject: | |
From: | |
Reply To: | |
Date: | Mon, 13 Nov 2000 21:33:32 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
> I'm looking for some help in creating a batch file for a
> Win2K server to do the following:
> (Actually I'm really hoping someone has something I can begin
> with to do what I need to do)
>
> 1. I need to read input from a tab delimited (or any delimiter)
> containing two columns per record
> 1st column containing a valid folder name on a Win2K server
> 2nd column containing an e-mail address
> 2. Once it's read I need to cd to the directory referenced
> in column 1
> and then create a new file named forward.ima that contains
> the value referenced in column 2.
> 3. I need to loop through the file repeating this process
> for all records.
>
> Does anyone have a batch file close to this that they would
> not mind sharing?
> We're a mostly Macintosh school district so we don't do much
> on the PC's....
Piece of cake:
@echo off
@rem File: fwdparse.cmd
if "%MailAddrParser%" equ "" goto docommand
if exist %1 goto gotdir
md %1
:gotdir
pushd %1
echo %2 > forward.ima
popd
goto exit
:docommand
set MailAddrParser=processing
for /F "eol=; tokens=1,2" %%i in (%1) do call fortest %%i %%j
rem or, to hard-wire the data file name:
rem for /F "eol=; tokens=1,2" %%i in (fordata.txt) do call fortest %%i %%j
set MailAddrParser=
:exit
sample data file 'fwdtest.txt:
dummy1 [log in to unmask]
dummy2 [log in to unmask]
Invoke as:
C:\>fwdparse fwdtest.txt
or hard-wire the data file name into the command file where indicated and
simply execute the command file. As written, the delimiter between the
directory name and address can be a space or a tab, and lines in the data
file with a semicolon in the first position will be ignored.
Steve
|
|
|