How do you list files, read a text file and search its contents from Windows command line?
Answer
In Command Prompt, `dir` lists files, `type file.log` prints a text file and `findstr` searches text or simple regular-expression patterns. In PowerShell, the common equivalents are `Get-ChildItem`, `Get-Content` and `Select-String`, which integrate with PowerShell objects and its pipeline.
Strong answer includes
- dir and Get-ChildItem list filesystem entries
- type or Get-Content reads text
- findstr or Select-String filters matching lines
Practical example
For a failed Windows test run, `findstr /i /n "error exception" app.log` can find matching log lines quickly; in PowerShell, `Select-String -Path app.log -Pattern 'error|exception'` gives richer match objects.