how to read line by line using batch

December 2, 2010 at 19:41:56
Specs: Windows XP
Goal: to disable users using the Native Security Domain in Informatica

So Informatica has a command to disable one user...I have about 100 users and having a hard time to figure out how to read each user one by one from the text file.

The command inside my batch file looks like this;

infacmd disableUser
-dn Domain -un Username -pd password -hp gateway:host -eu Existing user(to be disabled) -esd Existing Security Domain (for existing user)

This script currently works with one user. I have a .txt file that has all the users I want to disable...e.g
userlist.txt
Emp100
Emp200
Emp300
Emp005
Emp070

Using batch, how can I write a command to disable the users on the list one by one.

Any help will be greatly appreciated.

Thanks in advance


See More: how to read line by line using batch

Report •


#1
December 2, 2010 at 22:20:46
maybe:

@echo off & setlocal
for /f %%a in (list) do (
echo disabling access %%a
infacmd disableUser
-dn Domain -un Username -pd password -hp gateway:host -eu %%a -esd ...
)
::-------- end

(not sure what or how the security domain name is derived, hence the dots.)


infacmd disableUser
in -un Username -pd password -hp gateway:host -eu %%a -esd existing user)


Report •

#2
December 2, 2010 at 22:29:02
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in (userlist.txt) do (
-dn Domain -un %%a -pd password -hp gateway:host -eu Existing user(to be disabled) -esd Existing Security Domain (for existing user)
)


=====================================
Life is too important to be taken seriously.

M2


Report •

#3
December 3, 2010 at 06:13:09
Thank you good people. I tried your examples nbrane and Mechanix2Go and they both worked just fine.

Thanks a lot!!!


Report •

Related Solutions


Ask Question