Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use batch processing to ban all non-administrator users

Shulou Source: shulou.com Published: 2022-06-03 07:49:46 11月15日 Update

This article mainly shows you "how to use batch processing to ban all non-administrator users", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use batch processing to ban all non-administrator users" this article.

The local test is OK. Make sure that your computer's default user is adminstrator and that the user name has not been changed, or you will not be able to log in to the computer.

The code is as follows:

@ echo off:: by SKB setlocal enabledelayedexpansion net user | find / v "Command completed successfully" > 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 completes pause above is all the content of the article "how to use batch processing to ban all non-administrator users" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Users content articles computers learning help success code commands easy to understand more organization user names knowledge editing industry or information information channels channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Linux MariaDB Xiaomi vpn