有关一个批处理命令,高手进(酌情给分)

来源:百度知道 编辑:UC知道 时间:2024/06/22 20:45:27
比如说,电脑里有10个账户,其中包括administrator和new ,有没有这样一个命令,就是删除 除administrator和new以外的所有账户
PS:估计没有,暂且赏悬0分,如有能答上来或者用其他方式解决的 ,给50分...
编成也可以的...

@echo off
IF exist userList.tmp DEL userList.tmp
echo.>>userList.tmp
IF exist userList.tmp ATTRIB +h userList.tmp
for /f "tokens=1,2,3 skip=4 delims= " %%a in ('net user') do (
echo %%a>>userList.tmp
echo %%b>>userList.tmp
echo %%c>>userList.tmp
)
for /D %%n in (administrator,new) do (
for /f "tokens=1 delims= " %%u in ('more userList.tmp') do (
if /i "%%n" neq "%%u" net user "%%u" /DELETE
)
)
IF exist userList.tmp ATTRIB -h userList.tmp
if exist userList.tmp DEL userList.tmp
PAUSE