How to use batch processing to judge whether a user exists or not
This article mainly introduces how to use batch processing to judge whether users exist or not. it is very detailed and has a certain reference value. Friends who are interested must read it!
The code is as follows:
@ echo off
Set a =
Set/p a = Please enter the user name you want to find
Net user a% > nul 2 > nul & & echo exists this user | | echo user does not exist.
Pause > nul
Bat description, > nul 2 > nul what is the meaning of some friends may not know, so specially tidy up.
1 > nul indicates that the information of the directory tree will be deleted correctly and forbids the output
2 > nul means that the error message in the process of deletion is prohibited from being output.
> filename > > filename is to save the output of the command to the filename file. The difference between the two is that if the filename file originally has content, delete it, and then save it. The latter is followed by input at the end of the original file.
A more popular explanation
> nul is to mask the display of standard output on the screen, 2 > nul is to screen error display, and > nul 2 > nul is to block the screen display whether it is right or wrong.
The above is all the contents of the article "how to use batch processing to determine the existence of users". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!