For that reason, this would be my suggested answer, (excluding names within usernames.txt using findstr.exe):@For /F Tokens^=4Delims^=^" %%G In ('%SystemRoot%\System32\wbem\WMIC.exe UserAccount Where "LocalAccount='TRUE'" Assoc:List /ResultRole:SID 2^>NUL')Do @Set /P "=%%G"<NUL|%SystemRoot%\System32\findstr.exe /XVLIG:"usernames.txt"^ >NUL&&(For /F "Tokens=1*Delims==" %%H In ('%SystemRoot%\System32\wbem\WMIC.exe UserAccount Where "Name='%%G'" Get SID /Value 2^>NUL ^|%SystemRoot%\System32\find.exe "="')Do @For %%J In (%%I )Do @For /F "Tokens=1*Delims==" %%K In ('%SystemRoot%\System32\wbem\WMIC.exe Path Win32_UserProfile Where (SID^="%%J" And Special!^="TRUE" And LocalPath Is Not Null^) Get LocalPath /Value 2^>NUL^|%SystemRoot%\System32\find.exe "="')Do @For /F Tokens^=* %%M In ("%%L" )Do @Echo UserName:"%%G", UserProfile:"%%M") 这篇关于从WMIC查询中排除一些输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-11 04:41