net group / add / domain替​​代批处理文件windows xp

时间:2013-12-20 10:43:04

标签: batch-file

首先发布这里,我正在尝试创建一个批处理文件,允许技术人员提供带有计算机名称的文本文件并将其添加到安全组。我编写了以下使用NET GROUP,net group / domain工作的脚本,但我不能使用net group%filepath%/ add / domain。我所处的环境是Windows XP。请帮忙!欢呼声。

@echo off
title ModGroup
echo Discovering available groups on %USERDOMAIN%, please wait...
echo.
net group /domain > grouplist_.txt
set /p entgrpname=Type whole group name: 
findstr /i "%entgrpname%" grouplist_.txt > tmp2_.txt
(
set /p var=
)<tmp2_.txt
del tmp2_.txt
del grouplist_.txt
set var="%var:~1%"
echo.
rem ****%var% is the group name the user specified and its been verified to exist****
msg "%username%" WARNING! - You are about to edit the %var% group! - Please take extra caution whilst using this script!
echo.
echo Please enter the full filepath of the *.txt file that contains objects that you
echo want to add/remove.
echo.
set /p filepath=Filepath: 
echo.
(
set /p filepath2=
)<%filepath%
echo.
set /p addrem=Please specify if you would like to add or delete: 
cls
echo You're about to %addrem% the following objects to/from %var%:
echo.
echo %filepath2%
echo.
pause
echo.
echo Processing, please wait...
echo.

for /F "tokens=1 delims=" %%i in (%filepath%) do net group %var%
%%i /%addrem% /domain

echo. 
pause
exit

0 个答案:

没有答案