本地测试还可以,要保证你的电脑的默认用户是adminstrator而且没有修改用户名,要不就会无法登陆电脑了。
复制代码 代码如下:
@echo off
:: by SKB
setlocal enabledelayedexpansion
net user|find /v "命令成功完成" >tmp.txt
echo.>tmp2.txt
for /f "skip=4 tokens=1" %%i in (tmp.txt) do echo %%i >>tmp2.txt
for /f "skip=4 tokens=2" %%i in (tmp.txt) do echo %%i >>tmp2.txt
for /f "skip=4 tokens=3" %%i in (tmp.txt) do echo %%i >>tmp2.txt
for /f "skip=1" %%i in (tmp2.txt) do (
if not %%i==Administrator net user %%i /active:no
)
del tmp.txt
del tmp2.txt
echo 完成
pause