HP3000-L Archives

November 2000, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Steve Dirickson <[log in to unmask]>
Reply To:
Steve Dirickson <[log in to unmask]>
Date:
Mon, 13 Nov 2000 21:33:32 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (54 lines)
> 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

ATOM RSS1 RSS2