Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
用户 SID 可以从注册表(或其他)复制并仅使用命令行(Windows 7)粘贴到 txt 文件吗?
通过 WMIC
wmic useraccount where name='%username%' get sid | findstr /b /C:"S-1" > file.txt
通过 WHOAMI(如果在批处理文件中使用,则重复百分号)
for /F "tokens=2 delims=," %f in ('whoami /user /FO CSV /NH') do echo %~f > file.txt