JSI Tip 9521. Own.bat returns the owner of a file or folder?

Using the Corrected version of SubInAcl, I have scripted Own.bat to return the owner of the file or folder you specify.

The syntax for using own.bat is:

call own FileOrFolder OwnerVariable


FileOrFolder  is the path to the file or folder whose owner you want to determine.

OwnerVariable is a call directed environment variable that will contain the owner.
Own.bat contains:
@echo off
if \{%2\}

\{\} @echo Syntax: Own FileOrFolder OwnerVariable&goto :EOF if not exist %1 @echo Syntax: Own FileOrFolder %1 NOT found.&goto :EOF setlocal set owner=NONE set work="%TEMP%\WORK_%RANDOM%.TMP" SubInAcl /outputlog=%work% /noverbose /nostatistic /file %1 for /f "Tokens=1* Delims

" %%a in ('type %work%^|FIND "/owner"') do ( set owner=%%b ) endlocal&set %2=%owner%

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.