Copy / paste user sid using command line?

Is it possible to copy the user's SID from the registry (or something else) and paste into the txt file only using the command line (Windows 7)?

0
source share
1 answer

Via WMIC

wmic useraccount where name='%username%' get sid | findstr /b /C:"S-1" > file.txt

Via WHOAMI (duplicate percent signs, if used in a batch file)

for /F "tokens=2 delims=," %f in ('whoami /user /FO CSV /NH') do echo %~f > file.txt
+2
source

Source: https://habr.com/ru/post/1658052/


All Articles