dcandygmailcom

Lists ALL 19 of the attributes of a file or folder

Feb 1st, 2019
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.81 KB | None | 0 0
  1. REM Three files follow
  2. REM ListAttr.bat
  3. REM This file compiles ListAttr.vb to ListAttr.exe using the system VB.NET compiler.
  4. REM ListAttr.exe list all 19 of the attributes of a file or folder
  5. C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc "%~dp0\ListAttr.vb" /out:"%~dp0\ListAttr.exe" /target:exe
  6. Pause
  7.  
  8.  
  9. -----------------------------------------------------
  10. 'ListAttr.vb
  11. imports System.Runtime.InteropServices
  12. Public Module MyApplication  
  13.  
  14. Public Declare Unicode Function GetFileAttributesW Lib "Kernel32" (ByVal Path As String) As Integer
  15. Public Const FILE_ATTRIBUTE_ARCHIVE = 32
  16. Public Const FILE_ATTRIBUTE_COMPRESSED = 2048
  17. Public Const FILE_ATTRIBUTE_DEVICE = 64
  18. Public Const FILE_ATTRIBUTE_DIRECTORY = 16
  19. Public Const FILE_ATTRIBUTE_ENCRYPTED = 16384
  20. Public Const FILE_ATTRIBUTE_HIDDEN = 2
  21. Public Const FILE_ATTRIBUTE_INTEGRITY_STREAM = 32768
  22. Public Const FILE_ATTRIBUTE_NORMAL = 128
  23. Public Const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 8192
  24. Public Const FILE_ATTRIBUTE_NO_SCRUB_DATA = 131072
  25. Public Const FILE_ATTRIBUTE_OFFLINE = 4096
  26. Public Const FILE_ATTRIBUTE_READONLY = 1
  27. Public Const FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS = 4194304
  28. Public Const FILE_ATTRIBUTE_RECALL_ON_OPEN = 262144
  29. Public Const FILE_ATTRIBUTE_REPARSE_POINT = 1024
  30. Public Const FILE_ATTRIBUTE_SPARSE_FILE = 512
  31. Public Const FILE_ATTRIBUTE_SYSTEM = 4
  32. Public Const FILE_ATTRIBUTE_TEMPORARY = 256
  33. Public Const FILE_ATTRIBUTE_VIRTUAL = 65536
  34.        
  35. Public Sub Main ()
  36.     Dim Ret as Integer
  37.     Dim OutPut As String
  38.     Output = Command() & " "
  39.     Ret = GetFileAttributesW(Command())
  40.     If Ret = -1 Then
  41.         Console.writeline("Error " & err.lastdllerror)
  42.     Else
  43.         If (Ret And FILE_ATTRIBUTE_ARCHIVE) = FILE_ATTRIBUTE_ARCHIVE Then Output = OutPut & "Archive "
  44.         If (Ret And FILE_ATTRIBUTE_COMPRESSED) = FILE_ATTRIBUTE_COMPRESSED Then Output = OutPut & "Compressed "
  45.         If (Ret And FILE_ATTRIBUTE_DEVICE) = FILE_ATTRIBUTE_DEVICE Then Output = OutPut & "Device "
  46.         If (Ret And FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY Then Output = OutPut & "Directory "
  47.         If (Ret And FILE_ATTRIBUTE_ENCRYPTED) = FILE_ATTRIBUTE_ENCRYPTED Then Output = OutPut & "Encrypted "
  48.         If (Ret And FILE_ATTRIBUTE_HIDDEN) = FILE_ATTRIBUTE_HIDDEN Then Output = OutPut & "Hidden "
  49.         If (Ret And FILE_ATTRIBUTE_INTEGRITY_STREAM) = FILE_ATTRIBUTE_INTEGRITY_STREAM Then Output = OutPut & "Integrity_Stream "
  50.         If (Ret And FILE_ATTRIBUTE_NORMAL) = FILE_ATTRIBUTE_NORMAL Then Output = OutPut & "Normal "
  51.         If (Ret And FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) = FILE_ATTRIBUTE_NOT_CONTENT_INDEXED Then Output = OutPut & "Not_Content_Indexed "
  52.         If (Ret And FILE_ATTRIBUTE_NO_SCRUB_DATA) = FILE_ATTRIBUTE_NO_SCRUB_DATA Then Output = OutPut & "No_Scrub_Data "
  53.         If (Ret And FILE_ATTRIBUTE_READONLY) = FILE_ATTRIBUTE_READONLY Then Output = OutPut & "ReadOnly "
  54.         If (Ret And FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS) = FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS Then Output = OutPut & "Recall_On_Data_Access "
  55.         If (Ret And FILE_ATTRIBUTE_RECALL_ON_OPEN) = FILE_ATTRIBUTE_RECALL_ON_OPEN Then Output = OutPut & "Recall_On_Open "
  56.         If (Ret And FILE_ATTRIBUTE_REPARSE_POINT) = FILE_ATTRIBUTE_REPARSE_POINT Then Output = OutPut "Reparse "
  57.         If (Ret And FILE_ATTRIBUTE_SPARSE_FILE) = FILE_ATTRIBUTE_SPARSE_FILE Then Output = OutPut & "Sparse "
  58.         If (Ret And FILE_ATTRIBUTE_SYSTEM) = FILE_ATTRIBUTE_SYSTEM Then Output = OutPut & "System "
  59.         If (Ret And FILE_ATTRIBUTE_TEMPORARY) = FILE_ATTRIBUTE_TEMPORARY Then Output = OutPut & "Temporary "
  60.         If (Ret And FILE_ATTRIBUTE_VIRTUAL) = FILE_ATTRIBUTE_VIRTUAL Then Output = OutPut & "Virtual "
  61.     End If
  62.     Console.writeline(OutPut)
  63. End Sub
  64. End Module
  65.  
  66.  
  67. ------------------------------------------
  68.  
  69.  
  70.  
  71. REM ListAttrTest.Bat
  72. "%~dp0\ListAttr" C:
  73. "%~dp0\ListAttr" C:\
  74. "%~dp0\ListAttr" C:\Windows\System32\Catroot
  75. "%~dp0\ListAttr" nul
  76. "%~dp0\ListAttr" c:\bootnxt
  77. Pause
Advertisement
Add Comment
Please, Sign In to add comment