andykatafiaszwestfield
asked on
DOS Batch file command - inserting data
I need to have a batch file run that will add a user to a specific local group. I know the cvommand line is
net localgroup "Groupname" "username" \add.
However, I need to allow the user to add him or herself into the "username" area when the batch file runs.
This should be in a DOS command manner, or a script that can be called up when the batch file runs.
Any ideas out there?
Thanks in advance.
net localgroup "Groupname" "username" \add.
However, I need to allow the user to add him or herself into the "username" area when the batch file runs.
This should be in a DOS command manner, or a script that can be called up when the batch file runs.
Any ideas out there?
Thanks in advance.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you should be able to use the %USERNAME% variable in your batch file.
net localgroup "groupname" %username% /add
net localgroup "groupname" %username% /add
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
1. Have the user specify the user name on the command line - MYBATCH USERNAME
Then in the batch file, in place of username, use %1
2. Have the batch file prompt the user for the username -
SET /P Useraccount=Please Enter your username:
Then reference %Useraccount%
3. Use the username automatically.
net localgroup "Groupname" "%username%"