Skip to main content

command tricks

powershell

  • icacls ./file
    • PS C:\Log-Management> icacls .\job.bat
      .\job.bat BUILTIN\Users:(F)
                NT AUTHORITY\SYSTEM:(I)(F)
                BUILTIN\Administrators:(I)(F)
                BUILTIN\Users:(I)(RX)

      Successfully processed 1 files; Failed processing 0 files

  • type .\file
    • PS C:\Log-Management> type .\job.bat
      @echo off
      FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V
      IF (%adminTest%)==(Access) goto noAdmin
      for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G")
      echo.
      echo Event Logs have been cleared!
      goto theEnd
      :do_clear
      wevtutil.exe cl %1
      goto :eof
      :noAdmin
      echo You must run this script as an Administrator!
      :theEnd
      exit
  • Get-ChildItem -Path C:\ -Filter Log-Management -Recurse -ErrorAction SilentlyContinue -Force
    • it finds a file from a path
  • a
a
something is wrong with this version of the editor as of writing, so it will be messy / full of copy/paste. idk how to raw html encode some of this


cmd

  • n
  • a
  • a

shell

  • n
  • a
  • a