InfoSec, Microsoft help

Search for any file from a Windows cmd prompt – and read it from cmd prompt too

I was playing CTF game and was looking for a file called flag1.txt. Due to me only having shell access I found the following method to search for the file across the entire system.

You can use wildcards (*) to widen the search:

dir flag* /s /r

You can play around with the search term, but it cuts down on having to manually search around using “cd”. For best results make sure you are in the root/c: location.

To read the file from the Windows cmd prompt just use ‘type’, similarly to how cat works in Linux.

Lastly – if you haven’t started using it yet checkout the Windows Terminal from the Microsoft app store. It combines PowerShell, CMD Prompt, and my Azure cloud shell all in one location.

Leave a comment