Last updated: Apr 4, 2024
Reading timeยท3 min

The error "'cat' is not recognized as an internal or external command,
operable program or batch file" occurs when we use the cat command on Windows,
in a CMD shell.
To solve the error, use the type command to display the contents of a
file.

The type command is the Windows equivalent of the Unix/Linux cat command.
# ๐๏ธ Display the contents of a file named my_file.txt type my_file.txt # ๐๏ธ Display the contents of a lengthy file named my_file.txt, one screen at a time type my_file.txt | more

my_file.txt placeholder with the name of the file you want to read.The type command is used to display the contents of a text file.
You can pipe the output of the command to the more command to display the
contents of a lengthy file, one screen at a time.
# ๐๏ธ Display the contents of a lengthy file named my_file.txt, one screen at a time type my_file.txt | more
Note that you can use the cat command in PowerShell.
To open PowerShell:

Run the cat command directly in PowerShell to read the contents of a file.
cat my_file.txt

If you need to open PowerShell in a specific folder:
Shift and right-click in Explorer.
cat command.cat my_file.txt
cat command in Git Bash by installing git on your Windows machine.If you already have git installed, you can search for Git Bash and use the
cat command, otherwise, you have to install git first.
cat command in Git BashTo download git and be able to use Git Bash:
Next.
Next.
Click Next on the screen that prompts you to "Select Start Menu Folder".
On the next screen, you can choose the default editor for Git, e.g.
Notepad, Notepad++ or any other editor you prefer.

Next.

Next.Install button to install git.Once you have git installed, click on the Search field, type "Git Bash"
and start the application.

Now you can use the cat command directly in Git Bash.
cat my_file.txt

If you need to open Git Bash in a specific folder:

Now you can use the cat command to display the contents of a text file.
cat my_file.txt