🗂️

File Management in Windows and PowerShell

Jun 2, 2025

Displaying and Editing Files in Windows and PowerShell

Opening Files in Windows GUI

  • Double-click to open files in the default application.
  • Text Files: Usually open in Notepad, but can be changed.
    • Changing Default Application:
      • Right-click the file.
      • Click Properties.
      • Under Open With, choose another application like WordPad.

Focusing on Text and Configuration Files

  • Most files in this course will be text/configuration files.

Viewing File Contents in PowerShell

  • cat Command:

    • Stands for concatenate.
    • Dumps entire file content into the shell.
    • Not ideal for large files as it displays everything continuously.
  • more Command:

    • Displays file content page by page.
    • Pauses once the terminal window is filled.
    • Interact with more using:
      • Enter key: Advances by one line.
      • Spacebar: Advances by one page (page size = terminal window size).
      • Q key: Quit and return to the shell.

Viewing Specific Parts of a File

  • Head of the File:
    • Use cat with -head parameter to display the first ten lines.
  • Tail of the File:
    • Displays the last ten lines by default.

Summary

  • PowerShell allows flexible file viewing options.
  • Different commands offer varied ways to interact with text files, whether viewing entire contents, page-by-page, or specific sections.