Issues when getting a list of user profiles using WMIC
问题 I was using the following batch command to retrieve all local user profiles (including domain users too) : for /f "delims=" %%I in ('dir /a:d-h /b "%SystemDrive%\Users\*" 2^>nul ^| %SystemRoot%\System32\findstr.exe /i /l /x /v /g:"%bin%\exclude_users.txt"') do ( The problem is that this command has its limits: it doesn't really check if the users in question do actually have an account. The user Compo provided me a methodology for retrieving the profile names, using WMIC. So I ended up