# batch program to change user group



## electroon (Sep 17, 2008)

Hi All,

Can any one please let me know how to change a user group in windows batch file i.e. equivalent of "newgrp" in unix.

I mean is there a command which will change users group before a exe is invoked. I mean to say suppose users default group is A and is also a member of group B. Whenever a utility is invoked from my batch file I want to change user group to B, how can I do this??

Please let me know any info.

Thanks in advance


----------



## -Fabez- (Jul 28, 2008)

You can use the "net localgroup" command, which will add the selected user to a group you specify, if you need anymore help just ask


----------



## Codiah (Sep 27, 2008)

Slightly confused about your question, are you wanted to remove a user from one group and put them in another group all together, or are you just simply trying to add them to another group as well? in any case both are easy and use some pretty basic commands...

if that's all then you can use these commands,

to add someone to a group

*net localgroup *_GroupName_ _UserName_ */add*​to remove

*net localgroup *_GroupName_ _UserName_ */delete*
​Hope that's what your looking for...


----------

