Close Menu
JustWebWorldJustWebWorld
  • Astrology
  • Business & Finance
    • Cryptocurrency
    • Make Money
    • Entrepreneur
    • Brands
    • Companies
    • Personal Finance
      • Banking
      • Insurance
      • Trading and Investing
  • Tech
    • Computing
    • Cybersecurity
    • Electronics
    • Android
    • Apple
    • Gadgets
    • Social Media
    • Mobile Apps
    • Softwares
  • Education
    • Vocabulary
    • Abbreviations
    • General Knowledge
    • Writing & Translation
  • Lifestyle
    • Beauty & Cosmetics
    • Fashion & Style
    • Furniture & Decor
    • Luxury
    • People & Relationships
    • Pets and Animals
    • Shopping
    • Parenting
    • Gardening
    • Birthdays
  • Health
  • Travel
  • Auto
  • Gaming
  • Food
  • Entertainment
  • Sports
Facebook X (Twitter) Instagram
Thursday, May 15
  • About
  • Contact Us
  • Advertise With Us
  • Disclaimer
  • Terms & Conditions
  • Privacy Policy
JustWebWorldJustWebWorld
  • Astrology
  • Business & Finance
    • Cryptocurrency
    • Make Money
    • Entrepreneur
    • Brands
    • Companies
    • Personal Finance
      • Banking
      • Insurance
      • Trading and Investing
  • Tech
    • Computing
    • Cybersecurity
    • Electronics
    • Android
    • Apple
    • Gadgets
    • Social Media
    • Mobile Apps
    • Softwares
  • Education
    • Vocabulary
    • Abbreviations
    • General Knowledge
    • Writing & Translation
  • Lifestyle
    • Beauty & Cosmetics
    • Fashion & Style
    • Furniture & Decor
    • Luxury
    • People & Relationships
    • Pets and Animals
    • Shopping
    • Parenting
    • Gardening
    • Birthdays
  • Health
  • Travel
  • Auto
  • Gaming
  • Food
  • Entertainment
  • Sports
JustWebWorldJustWebWorld
Home » Technology » Computing » Windows

How to Create and Run BAT File

Michael AustinBy Michael Austin Windows
Facebook Twitter LinkedIn Telegram Pinterest Reddit Email WhatsApp
Follow Us
WhatsApp Telegram
Share
Facebook Twitter LinkedIn Pinterest Reddit Telegram WhatsApp

Often the tips for various actions and fixes in Windows 10, 8 and Windows 7 include steps like: “create a .bat file with the following content and run it.” However, a novice user doesn’t always know how to do this and what a file .bat is.

Batch file - File format

This manual details how to create a bat command file and run it. Wikiext.com will provide you with more interesting options of a .bat file.

Creating a .bat file using Notepad

The first and easiest way to create a bat file is to use the standard Notepad program that is present in all current versions of Windows.

Creating DOS Batch Files

Steps to create a bat file:

  • Start Notepad (located in Programs – Standard, in Windows 10 – through the search in the taskbar, if notepad is not in the Start menu, you can start it from C:\Windows\notepad.exe.
  • Enter the code for your bat file into the notepad (for example, copy from somewhere, or write your own).
  • In the Notepad menu, select “File” – “Save As”, select the location where the file is saved, specify the file name with the .bat extension, and, in the “File Type” field, select “All Files”.
  • Click the Save button.

Note: if the file is not saved to the specified location, for example, to drive C, with the message “You do not have permission to save files in this location”, save it to the Documents folder or desktop, and then copy to the desired location (the cause of the problem is that Windows 10 requires administrator rights to write to some folders, and since the notepad was not started as an administrator, it cannot save the file to the specified folder.)

Your .bat file is ready: if you run it, all the commands listed in the file will be automatically executed (if there are no errors and you have administrator rights: in some cases, you may need to run the bat file as administrator: right click on the .bat file – run as administrator in the context menu).

In the future, if you want to edit the created file, just right click on it and select “Edit”.

There are other ways to make a bat file, but they all boil down to writing one command per line into a text file in any text editor (without formatting), which is then saved with a .bat extension (for example, in Windows XP and 32-bit Windows 7 you can even create a .bat file on the command line using the text editor edit).

If you have enabled the display of file extensions (it changes in the control panel – Explorer options – view – hide extensions of registered file types), you can simply create a .txt file, then rename the file by installing the .bat extension.

Running programs in the bat file and other basic commands

Most often, the following tasks occur: launching a program or several programs from a .bat file, launching a function (for example, clearing the clipboard, distributing Wi-Fi from the laptop, turning off the computer by the timer).

How to Run a BAT File

To run the program or programs, use the command:

start “” path_to_program

If the path contains spaces, take the entire path in double quotes, for example:

start “” “C:\Program Files\program.exe”

After the path to the program, you can also specify the parameters with which it should be run, for example (similarly, if the startup parameters contain spaces, take them in quotation marks):

start “” c:\windows\notepad.exe file.txt

In double quotes, after start, the specification must specify the name of the batch file displayed in the command line header. This is an optional parameter, but in the absence of these quotes, executing bat files containing quotes in paths and parameters can go in unexpected ways.

Another useful feature is the launch of another bat file from the current file. You can do it using the call command:

call path_to_file_bat options

The passed parameters at startup can be read inside another bat file, for example, we call a file with parameters:

call file2.bat parameter1 parameter2 parameter3

In file2.bat, you can read these parameters and use them as paths, parameters for launching other programs in this way:

echo% 1

echo% 2

echo% 3

pause

For each parameter we use its serial number with a percent sign. The result in the above example will output all the passed parameters to the command window (the echo command is used to output text to the console window).

By default, the command window closes immediately after all commands are executed. If you need to read the information in the window, use the pause command – it will stop executing the commands (or closing the window) before pressing any key in the console from the user’s side.

Sometimes, before executing the next command, you need to wait a while (for example, before the first program is fully launched). To do this, you can use the command:

timeout/t time_in_seconds

If desired, you can run the program in minimized or expanded video with the MIN and MAX parameters before specifying the program itself, for example:

start “”/MIN c:\windows\notepad.exe

To close the command window after all the commands have been executed (although, usually it is already closed when using start to start), use the exit command in the last line. If the console still does not close after starting the program, try using this command:

cmd/c start/b”” path_to_program parameters

In this command, if the paths to the program or parameters contain spaces, there may be problems with the launch, which can be solved as follows:

cmd/c start “”/d “path_to_space_folder”/b program_file_name “parameter_space_blocks”

Follow on WhatsApp Follow on Telegram
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Telegram WhatsApp Copy Link
Previous Article7 Must-Have Checks In A Good SEO Audit
Next Article How to Deal With Crawl Errors In Google Search Console
Michael Austin
  • Website
  • Facebook
  • X (Twitter)
  • Pinterest
  • Instagram
  • LinkedIn

Michael Austin is an expert writer who loves creating engaging and easy-to-understand content. With years of experience, he specializes in writing well-researched articles that inform, inspire, and entertain readers. His clear and simple writing style makes complex topics easy to grasp. Whether it's trending news, helpful guides, or expert insights, Michael’s content is designed to be valuable and SEO-friendly, ensuring it reaches the right audience. Stay connected for his latest articles!

Related Posts

How To Fix A Stuck Windows Update

Simple Ways To Disable Microsoft Compatibility Telemetry In Windows 10

How to Fix the BSOD Error 0x4 INVALID_DATA_ACCESS

How to Optimize Your PC Performance – 7 Tools Which Help You to Boost It Up

Fix Msvcp100.dll Missing Or Not Found Error In Windows 10

How to Effectively Protect Your Windows 10 PC Or Laptop?

Leave A Reply

Categories
Translate
Archives
DMCA.com Protection Status

Who Is Brent Faiyaz? Age, Songs, Albums, Net Worth & Tour 2025

FaZe Rug Net Worth, Age, Girlfriend, House & Career | Must Read

Happy Father’s Day Wishes & Quotes | Heartfelt Messages, Sayings & Captions for Dad 2025

Why Stewart Vickers Is the Best SEO Expert in the World

Diljit Dosanjh : Latest Songs, Movies, Net Worth, Concerts & Full Biography

Katie Ledecky: Olympic Gold Queen | Records, Career, Net Worth & More!

Best New Clinic Opening Wishes | Heartfelt Messages, Quotes & Blessings to Celebrate Success

Brixton Cromwell 1200 Review 2025 | Price, Specs, Mileage & Top Speed Revealed!

Inverter Batteries 101: Understanding Types, Features And Performance For Your Needs

Best Alternatives to Balance Transfers | Smart Ways to Pay Off Debt Faster!

Quick Links
Age Calculator
Angel Number Calculator
Case Converter
Sudoku Online
Word Counter
Love Calculator
Useful Links
Number to Words
Period Calculator
Yes-No Picker Wheel
Demon Name Generator
Kingdom Name Generator
Harry Potter Name Generator
Helpful Resources
Colors Name In English
Best Computer Brands
WhatsApp Web
Most Beautiful Beaches
Tesla Cybertruck Review
Richest Actors in the World
Explore More
Good Morning Handsome
Best English Songs of All Time
Cricket World Cup Winners
Ways to Say Rest In Peace
Britain’s Got Talent Winners
American Idol Winners
Facebook X (Twitter) Instagram Pinterest YouTube Tumblr LinkedIn WhatsApp Telegram Threads RSS
  • About
  • Contact Us
  • Advertise With Us
  • Disclaimer
  • Privacy Policy
  • Terms & Conditions
  • Web Stories
Copyright © 2012-2025. JustWebWorld - All Rights Reserved. | Sitemap

Type above and press Enter to search. Press Esc to cancel.

×

👇 Bonus Reads for You 🎁

"BOOTMGR is Missing" - How to Fix?
How to Fix ‘BOOTMGR’ Is Missing Errors?
Effectively Protect Your Windows 10 PC
How to Effectively Protect Your Windows 10 PC Or Laptop?
Enable or Disable User Accounts in Windows 10
How to Enable or Disable a Windows 10 User Account
Music Converter for Spotify Windows
Tuneskit Spotify Music Converter Windows