批处理将非administrator用户全部禁掉的代码
(编辑:jimmy 日期: 2024/11/15 浏览:3 次 )
本地测试还可以,要保证你的电脑的默认用户是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
复制代码 代码如下:
@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
下一篇:文本文件乱序排列bat实现代码