Can user SID be copied from registry (or whatever) and pasted to a txt file using command line only (Windows 7)?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Via WMIC
wmic useraccount where name='%username%' get sid | findstr /b /C:"S-1" > file.txt
Via WHOAMI (duplicate percent signs if used in batch file)
for /F "tokens=2 delims=," %f in ('whoami /user /FO CSV /NH') do echo %~f > file.txt