批处理将非administrator用户全部禁掉的代码
时间:2021-05-09 07:44:03|栏目:DOS/BAT|点击: 次
本地测试还可以,要保证你的电脑的默认用户是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
上一篇:安全工具netsh IPSec使用方法[ip安全策略]
栏 目:DOS/BAT
下一篇:for语句中的几种分隔符形式小结
本文标题:批处理将非administrator用户全部禁掉的代码
本文地址:http://www.codeinn.net/misctech/117764.html