用户SID使用命令行复制/粘贴?

时间:2013-11-04 11:15:59

标签: command-line cmd sid

是否可以从注册表(或其他)复制用户SID并使用命令行粘贴到txt文件(Windows 7)?

1 个答案:

答案 0 :(得分:2)

通过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