Notepad and BAT Files: Fun Things You Can Do
In this article
Yes, Notepad and .bat files can be genuinely fun. A batch file is a plain-text script that Windows runs line by line in the Command Prompt, and with a few lines of code you can make your computer talk, open multiple programs at once, create a simple game, or prank a friend. You don't need any programming experience, just Notepad, a text editor built into every Windows PC.
What Exactly Is a Batch File?
A .bat file (short for batch) is a text file with a .bat or .cmd extension. Each line is a command that Windows executes in order, just as if you typed it into Command Prompt. You create one by opening Notepad, typing commands, and saving the file with a name like fun.bat — make sure the “Save as type” drop-down is set to “All Files,” otherwise Notepad will append .txt and the file won’t run as a batch.
To run it, double-click the file. A black Command Prompt window opens, runs the commands, and closes (unless you add pause at the end to keep it open). You can also right-click and choose “Edit” to change the code anytime.
Fun Batch File Ideas You Can Type Right Now
Here are a few simple, safe scripts. Copy each into Notepad, save with a .bat extension, and run.
- Make your PC talk: Use the built-in
mshtawith a VBScript speech line:mshta vbscript:CreateObject("SAPI.SpVoice").Speak("Hello, this is fun")(window.close). It speaks through your speakers. - Open several programs at once: Type
start notepad,start calc,start cmdon separate lines. Double-click and all three open together. - Create a simple countdown timer: Use
timeout /t 10to wait 10 seconds, then show a message withmsg * "Time's up!". - Matrix-style falling text: A short loop like
@echo off,color 0a, then:loop,echo %random% %random% %random%,goto loopproduces a waterfall of random numbers. Press Ctrl+C to stop. - Folder bomb (harmless version): Create a script that makes a few folders with
mkdir fun1 fun2 fun3. Avoid the infinite recursive version that creates thousands of folders — it can freeze your PC.
How to Write Your First Batch File Safely
Start with these steps:
- Open Notepad (press Windows key, type “Notepad”).
- Type a command, for example
echo Hello World. - Click File > Save As.
- Change “Save as type” to “All Files (*.*)”.
- Name it
hello.bat(the.batis essential). - Double-click the file in File Explorer.
That’s it. The window will show “Hello World” and close immediately unless you add pause on the next line. Add @echo off at the top to hide the command lines themselves, so only your message appears.
Common Problems and How to Fix Them
If your batch file doesn’t work, check these first:
- It opens in Notepad instead of running: That means the file is actually a .txt file. Rename it so the extension is exactly
.bat. In File Explorer, enable “File name extensions” under the View tab to see the full name. - It flashes and closes instantly: Add
pauseas the last line. That keeps the window open until you press a key. - “Access is denied” error: You might be trying to run a command that needs administrator rights. Right-click the .bat file and choose “Run as administrator” only if you trust the script.
- Special characters like
%or&cause errors: In batch files,%is used for variables, and&separates commands. To print a literal percent sign, use%%. For ampersand, put the whole line in quotes or use^&.
Batch Files vs. PowerShell vs. Python
Batch files are the simplest way to automate Windows tasks, but they have limits. PowerShell is more powerful — it can manipulate files, access the registry, and handle complex logic. Python is a full programming language that can do almost anything, but it requires installation and a bit more learning. For quick fun scripts, batch files are perfect because they need no extra software and run on any Windows machine.
If you want to move beyond batch, PowerShell is already installed on all modern Windows systems. You can run a PowerShell script (.ps1) but by default Windows blocks them for security. To run one, you’d need to change the execution policy, which is a more advanced step. Python requires downloading from python.org. For a beginner, stick with batch.
Is It Safe to Run Batch Files from the Internet?
No, not automatically. Batch files can run any command that you have permission to run, including deleting files, changing system settings, or downloading malware. Only run .bat files you wrote yourself or that come from a trusted source. If a friend sends you a “fun” .bat file, open it in Notepad first and read the code. If you see commands like del, format, reg delete, or shutdown, it could be harmful. A safe rule: never run a batch file that you don’t fully understand.
Also be aware that some prank scripts use shutdown /s to turn off the PC, or msg * to pop up messages. Those are annoying but not destructive. Avoid anything that deletes files or modifies the registry.
Beyond the Basics: Fun Projects to Try
Once you’re comfortable with the basics, try these slightly more advanced ideas:
- Text-based adventure game: Use
set /pto ask the player a question, andifstatements to branch the story. For example,set /p choice=You see a door. Open it? (y/n):thenif %choice%==y echo You found treasure! - System info display: Run
systeminfooripconfigto show your computer’s details. It’s not “fun” per se, but it’s a neat way to learn. - Create a simple menu: Use
echoto show options,set /pto get a number, andgototo jump to a label like:menu. This lets you build a multi-tool script. - Make a fake error message:
msg * "Error 404: Humor not found"pops up a dialog box. It’s a classic prank, but harmless if you tell the person it’s a joke.
Remember that batch files are case-insensitive, so ECHO and echo do the same thing. Also, you can comment out a line with rem — anything after rem is ignored. That’s useful for leaving notes in your code.
Frequently Asked Questions
Can a batch file damage my computer?
Yes, a batch file can damage your computer if it contains destructive commands like format, del, or rd. Always review the code before running any .bat file you didn’t write yourself. Simple scripts that only open programs or print text are safe.
Why does my .bat file open in Notepad instead of running?
That happens when the file extension is actually .txt. Windows hides known extensions by default, so a file named “fun.bat.txt” looks like “fun.bat” in File Explorer. Enable “File name extensions” in the View tab, then rename the file to end with .bat.
How do I make a batch file run as administrator?
Right-click the .bat file and choose “Run as administrator.” If you want it to always ask for admin rights, you can create a shortcut, then right-click the shortcut > Properties > Advanced > “Run as administrator.” Some commands like ipconfig /flushdns don’t need admin, but others like net stop do.
Can I convert a batch file to an .exe?
There are tools that convert .bat to .exe, but they are not officially supported by Microsoft. The resulting .exe is just a wrapper that runs the same commands, and antivirus software may flag it as suspicious. It’s usually simpler to keep the .bat file.
Is there a way to run a batch file silently (no black window)?
Yes, you can use a VBScript wrapper that runs the batch file hidden. Create a .vbs file with this line: CreateObject("WScript.Shell").Run "C:\path\to\your.bat", 0. The 0 hides the window. This is a common trick, but note that some antivirus programs may block it because hidden scripts are often used by malware.
What’s the difference between .bat and .cmd?
Both run batch commands, but .cmd is processed by the newer Command Processor (cmd.exe) with slightly different error handling. For practical purposes, they work the same for most scripts. Use .bat for simplicity.