windows – List of local users in bat file


The task is to make a list of local users using a bat-file with parameters like the last login time and the password action.

How is it possible to combine the execution of net user user1 net user user2 etc.

and filter the output to specific parameters.


The net user command displays usernames in a table: in 3 columns 25 characters wide. It turns out that you need to collect all the rows of the table into a string variable, and then parse it. It's easier to use a command that immediately prints the names of local users: wmic useraccount where (localaccount="True") get Name . And for each received name, already force it to output the command in a loop: net user <name>

Scroll to Top