Batch files using IfMember

This week, I wanted to remind you of a useful batch file utility called

IfMember (ifmember.exe) which can be found in the Windows 2000 Resource

Kit or on Microsoft's website at:

http://www.microsoft.com/windows2000/techinfo/reskit/tools/new/ifmember-o.asp

IfMember is a great utility for checking a user's membership while

processing a batch file. For example, let's assume that you have a

batch file in which you want to run one subset of commands if a user is

a member of a special migration group called MigrationUsers. If they are

not a member of the group, and you do not want to execute the migration

commands, you would rather exit the batch file. By using IfMember you

will be able to accomplish this using the following code snippet:

----- Begin Code Snippet ----

@echo off

:Begin

ifmember "MigrationUsers"

if not errorlevel 1 goto NoMigration

:Migrate

rem Put your code to do migration here

Top 10 Hot Internet of Things Startups
Join the discussion
Be the first to comment on this article. Our Commenting Policies