Batch files are used widely by computer handyman to simplify everyday tasks, to shorten the time and save unnecessary hassle. So what is a batch file? Can you create a batch file yourself? How to run the bat file on computer? These questions will be answered below.
You’d better turn to MiniTool Solution when you want to secure data or recover lost files from PC.
How to Create a Batch File Windows 10
What is batch file?
Batch file (also known as bat file) is actually a special kind of text file with a .bat extension. You can put some commands into the batch file to turn a complex process into a simple task. In this way, the commands can be run in sequence as soon as you click on the file. In short, the bat file is a script file in DOS, OS/2 and Microsoft Windows.
People are wondering how to create a batch file easily. Therefore, this part will focus on how to make a batch file in 2 ways.
How to Create a .bat File in Microsoft Windows 10
Firstly, you need to make sure you have a text editor (Notepad or WordPad is ok) and some basic using knowledge of Command Prompt. Then, follow the steps below.
How to make a bat file (simple bat file):
Step 1. Right click on the blank area on your PC screen.
Step 2. Choose New from the menu.
Step 3. Select Text Document from the submenu.
Step 4. Double click on the New Text Document file on desktop to open Notepad window.
Step 5. Type the following content into it:
@ECHO OFF
ECHO Congratulations! Your first batch file executed successfully.
PAUSE
Step 6. Select File from menu bar.
Step 7. Select the Save As… option.
Step 8. Type a name into the textbox after File name (add .bat extension to it) and choose a location to save the simple batch file.
Step 9. Click on the Save button to confirm.
There’s another way to open the Notepad window:
- Click on the Cortana search icon/box on taskbar.
- Type notepad and select Notepad from the result.
If you want to create an advanced Windows batch file or actionable batch file, you should also open the Notepad window -> type the corresponding content -> save it as a bat file.
4 Ways To Recover Notepad File On Win 10 Quickly!
How to Create a Bat File in MS-DOS
This way only works on the computers running a 32-bit version of Windows. If your system is 64 bit, please use the above steps.
Step 1. Open Windows search box and type cmd.
Step 2. Select Command Prompt from the result to open MS-DOS prompt.
Step 3. Type edit test.bat and hit Enter.
Step 4. A blue edit screen will appear. Type the following content into it:
@echo off
echo Hello this a test batch file
pause
dir c:\windows
pause
Step 5. Find and click File.
Step 6. Choose exit from the menu.
Step 7. Click on the Yes button to save it.
If you want to execute the test.bat file, just go back to the MS-DOS prompt -> type test -> hit Enter.
That’s all about how to create.bat files.
How to Run a Batch File
Run in file explorer:
- Open File Explorer on your Windows 10.
- Navigate to the drive and folder that include the Windows batch file.
- Just double click on the batch file to run it.
Click here if your File Explorer is not responding or has stopped working.
Run a batch file from Command Prompt:
- Open Windows search and type cmd.
- Right click on Command Prompt and choose Run as administrator.
- Type C:\Users\folder location\filename.bat and hit Enter.
In addition, you can run a bat file in Windows 10 on scheduled through Task Scheduler or run the batch file on startup via file explorer.
The Command Prompt tool can also be used to recover files on Windows 10.