Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Need help with a XP Shell script to create local groups based on a file

Avatar of washy16
washy16Flag for Canada asked on
Windows XPWindows Batch
24 Comments1 Solution556 ViewsLast Modified:
Hi Experts! I've never done scripting in the Windows Shell before and I need some help.

Based on a .txt file I need to make a script that creates local groups but only creates a group if it doesn't already exist. I can create groups without a hitch, but I'm stuck on how to only make it if it doesn't exist part. The sample txt file I'm working with looks like this:

New Employees

LastName       FirstName      employeeID      Department
Doe                       John               A003            News
Smith             Dave                 B005            Distribution

The code I have to create the group so far is this:

FOR /f "tokens=4 skip=6" %%a IN (HiredPersonnelTest.txt) DO NET LOCALGROUP %%a /add

Any help would be appreciated.

Avatar of t0t0
t0t0Flag of United Kingdom of Great Britain and Northern Ireland image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 24 Comments.
See Answers