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:

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


ifmember "MigrationUsers"

if not errorlevel 1 goto NoMigration


rem Put your code to do migration here

Free Course: JavaScript: The Good Parts
View Comments
You Might Like
Join the discussion
Be the first to comment on this article. Our Commenting Policies