File Extensions (Windows)

The part of your filenames so powerful Windows doesn't want you to see it

Understanding File Extensions in Windows

Welcome to our beginner's guide on file extensions in Windows! In this post, we'll cover the basics of what file extensions are, why they're important, and how to manage them effectively. By the end of this guide, you'll be on your way to becoming a power user who isn't afraid to see and manage file extensions.

What is a File Extension?

A file extension is a part of the file name that indicates the type of file it is and which program should open it. In Windows, file extensions are typically hidden by default, but we're going to show you how to reveal them and why you should.

Example: The file hello.txt has a .txt extension, indicating it's a text file.

Showing File Extensions in Windows

Windows hides file extensions by default, which can be inconvenient for power users. Here’s how to reveal file extensions:

  1. Open your folder: Navigate to the folder containing your file. For this example, let's open a folder with a file named hello.txt.
    • Click on the View menu at the top of the window.
    • Click on Show and then check the box next to File name extensions.

Change the view settings:

Screenshot showing the View tab with the File name extensions option highlighted.
File Explorer View menu to show File name extensions

Now, you'll see the file name change from hello to hello.txt. The .txt extension was always there; Windows was just hiding it from you.

Understanding and Changing File Extensions

Knowing what your file extensions are can help you better manage and use your files. Let's say you want to change a text file into a batch script. Here's how to do it:

@echo off
echo hello world
pause
@echo off
echo Hello World
pause
  1. Double-click hello.txt to open it in Notepad.
  2. Type the following code:
    @echo off
    echo Hello World
    pause
    
  3. Save and close the file.
  4. Click on the file name and press F2 on your keyboard, or click the file name, wait a moment, then click it again to edit.
  5. Change the extension from .txt to .bat. This tells Windows to treat the file as a batch script rather than a text document.
  6. A warning will pop up saying, "If you change a file name extension, the file might become unusable. Are you sure you want to change it?"
  7. Click Yes to confirm. This warning is usually safe to ignore as long as you know you intended to change the file extension.

Confirm the change:

Screenshot showing the Windows warning message.
As long as you intended to change the file extension, you're fine to say yes.

Change the file extension:

0:00
/0:06

Running Your New Batch Script

With the file now named hello.bat, notice the icon change to gears, indicating it's a batch file.

    • Instead of opening in Notepad, it now opens in a command prompt window and runs the script.
    • You should see Hello World printed in the command prompt, followed by a prompt to "Press any key to continue."

Key Takeaways

  • File extensions are crucial for letting the operating system know which program to use to open a file.
  • Always show file extensions by changing your view settings in Windows. This practice is essential for power users.
  • Changing file extensions does not alter the contents of the file, only how the operating system handles it.

By understanding and managing file extensions, you can take greater control of your files and their associated programs. Happy computing!