Windows cmd command to list all files, folders, and subfolders with the full path and owner name


I am looking for Windows cmd command to list all files, folders and sub-folder with full path and owner name.

I have checked DIR /Q option which gives owner name but how to display that along with files or folder in following way ?

  • C:\folder\file1.txt user1
  • C:\folder\file2.exe user2
  • C:\folder\ user1
  • C:\folder\file4.doc user2
  • C:\folder\file5.dll user1

Moving my PowerShell approach from the comment section to be an answer:

powershell -Command "gci c:\test -recurse |% { $_.fullname +' '+ $($_|get-acl|select -expand owner).Split('\')[1]}

Example output:

D:\t\a User
D:\t\b User
D:\t\a\aa User
D:\t\a\dd.txt User
D:\t\b\bb User
D:\t\b\cc.txt User