Shell Command Reference

Shell Command Reference

Reboot to BIOS

* Windows:

  shutdown /r /fw /f /t 0

* Linux:

  systemctl reboot --firmware-setup

Find filename in filesystem containing flag

* Windows:

  where /r c:\ *flag*

* Linux:

  find / -name flag

Find key in file on filesystem

* Windows:

  findstr /I /M /S key c:\*

* Linux:

  grep -rnw '/' -e 'key'

Check DLL signature for list of files

* Windows:

  where /r c:\ *.dll > c:\tmp\dlllist.txt
  FOR /F "usebackq delims=" %I IN (c:\tmp\dlllist.txt) DO signtool.exe verify /a /v /pa /d /all /d "%I" >> c:\Users\Jason\Desktop\log.txt

Clean up Windows host temp files, and speed up UI by ensuring data read sequentially is contiguous.

Download contig by Mark Russinovich at the Microsoft Sysinternals Webpage. Extract and place cleanup.bat in the same directory. Right-click and run as Administrator. Accept the EULA for contig by double-clicking contig.exe before running cleanup.bat.

cleanup.bat

REM @echo off
 setlocal

 set UserRoot=C:\Documents and settings
 set UserRoot2=c:\users

 REM *** Process all profile folders:

 for /d %%a in ("%UserRoot%\*.*") do call :process "%%a"

 REM *** Process the system temp folder:

 del /F /S /Q "c:\windows\temp\*.*" /s

 del /F /S /Q "c:\windows\system32\temp\*.*" /s

 del /F /S /Q "c:\windows\*.tmp" /s

 del /F /S /Q "c:\windows\*.temp" /s

 del /F /S /Q "c:\windows\system32\*.temp /s

 del /F /S /Q "c:\windows\system32\*.tmp" /s

 del /F /S /Q "c:\windows\prefetch\*.*" /s

 rd /s /q "c:\windows\temp"

 md "c:\windows\temp

 rd /s /q "c:\windows\system32\temp"

 dism /online /cleanup-image /spsuperseded
 c:\contig.exe -s $Mft
 c:\contig.exe -s $LogFile
 c:\contig.exe -s $Volume
 c:\contig.exe -s $AttrDef
 c:\contig.exe -s $Bitmap
 c:\contig.exe -s $Boot
 c:\contig.exe -s $BadClus
 c:\contig.exe -s $Secure
 c:\contig.exe -s $UpCase
 c:\contig.exe -s $Extend
 c:\contig.exe -s c:\*
 goto :eof
 :: *** subroutine 'process' starts here:
 :process
 set UserFolder=%~1

 echo Processing %UserFolder% ...

 REM *** %UserFolder% now contains the folder name currently being processed.

 REM *** Add your backup/deletion code between this line and the "goto :eof" at the end:

 del /F /S /Q "%UserFolder%\local settings\temp\*.*" /s
 rd  /s /q "%UserFolder%\local settings\temp"

 md "%UserFolder%\local settings\temp"
 attrib -h -s "%UserFolder%\local settings\temporary internet files"

 del /F /S /Q "%UserFolder%\local settings\temporary internet files\*.*"
 rd /s /q "%UserFolder%\local settings\temporary internet files"

 md "%UserFolder%\local settings\temporary internet files"