• Home
  • Office
  • Windows
  • Server
bmacf
No Result
View All Result
  • Home
  • Office
  • Windows
  • Server
No Result
View All Result

How To Create A Batch Script On Windows

July 24, 2025
in 2025, Blog
ADVERTISEMENT

Table of Contents

Batch files are a handy way to automate everyday tasks, make processes more efficient, and turn complicated operations into simple, user-friendly actions that anyone can run.

Bg2120.png

In this article, you’ll learn how to write a simple batch file, explore the basics of what batch files can do, and discover how to create them yourself. Additionally, I’ll provide resources to help you further develop your skills in writing batch (BAT) files.

How to Create a Batch File on Windows

To create a Windows batch file, follow these steps:

1. Open or create a new text file using Notepad or WordPad document or any text editor.

Bg2124.png

2. Add your commands:

  • @echo off : This parameter will allow you to view your working script in the command prompt. This parameter is useful for viewing your working code. If any issues arise from the batch file, you will be able to view the issues associated with your script using the echo function. Adding a following off to this parameter will allow you to quickly close your script after it has finished.
  • title This is your first batch script: Providing much of the same function as a <title> tag in HTML, this will provide a title for your batch script in your Command Prompt window.
  • echo Welcome to batch scripting: Print “Welcome to batch scripting” 
  • pause: Allows a break in the logical chain of your BAT file. This allows for users to read over command lines before proceeding with the code. The phrase “Press any key to continue…” will denote a pause.
@echo off
title This is your first batch script.
echo Welcome to batch scripting.
pause
Bg2121.png

3. Next, save your text file with the .bat file extension by navigating to the menu and selecting Save As... option.

Bg2122.png

4. In the Save As window:

  • Change Save as type to All Files
  • Then type a filename with .bat as the file extension.
Bg2123.png

5. Now, double-click on your newly created batch file to run it.

ADVERTISEMENT
Bg2125.png

And here’s the corresponding command window for the example above:

Bg2126.png

6. To edit the batch script, let’s right click on it then select Edit.

Basics of Batch Scripting

Batch files use the same language as the Command Prompt, but instead of typing commands manually, you input them into a file, saving time and effort. They also allow for basic logic, such as loops, conditional statements, and other procedural programming concepts.

More basic parameters for batch scripting:

  • cls: Clears your command prompt, best used when extraneous code can make what you’re accessing had to find.
  • rem: Shorthand for remark provides the same functionality as <!– tag in HTML. Rem statements are not entered into your code. Instead, they are used to explain and give information regarding the code.
  • %%a: Each file in the folder.
  • (“.\”): The root folder. When using the command prompt, one must direct the prompt to a particular directory before changing a files name, deleting a file, and so on. With batch files, you only need to paste your BAT file into the directory of your choosing.

The library for batch variables is huge, to say the least. Luckily there is a Wikibook entry that holds the extensive library of batch script parameters and variables at your disposal.

Examples of batch scripts

In this section, we’ll create examples of batch scripts designed to streamline and simplify your daily online and offline tasks.

Batch file to open websites

The script below uses multiple start “” parameters to open several websites in separate tabs through a batch file. Simply replace the provided links with your desired URLs.

@echo off
start "" http://www.bbc.com
start "" https://google.com/
start "" https://bonguides.com/
Note Note: Without the pause parameter, the batch file will close automatically after executing the last command.
Bg2127.png

Batch file that opens multiple programs

If you frequently open the same set of applications, you can create a custom launcher batch file to open multiple programs simultaneously with just one click.

All you need is the file location of each program. For example, if you need to open Excel, Calculator, and Microsoft Edge, use the following code snippet:

@echo off
cd "C:\Program Files\Microsoft Office\root\Office16\"
start excel.exe

start calc.exe

cd "C:\Program Files (x86)\Microsoft\Edge\Application"
start msedge.exe
Bg2128.png

Batch file to restart your computer

The below script will restart your computer after 5 seconds.

@echo off
shutdown -r -t 5
Bg2129.png

Conclusion

Hello Friends! My name is Leo, and I’m excited to share everything I know about activating Microsoft software products. In the past, I managed several YouTube channels on this topic, but they were taken down by Microsoft. That’s why I decided to start this blog to keep the conversation alive without interruptions. I’m committed to sharing my knowledge and insights for as long as possible!

If you have any questions or concerns, feel free to leave a comment or visit my Discord server. I’d be happy to provide more details. Thank you so much for your feedback and support!

Buy Me A Coffee

Want to activate others Microsoft products for free? You can follow the below posts:

  • Windows 7/8/8.1/10/11
  • Windows Servers 2008/2012/2016/2019/2022
  • Microsoft Office 2013/2016/2019/2021 (included Visio and Project)
5/5 - (1 vote)
ADVERTISEMENT
Previous Post

Microsoft Windows and Office KMS Setup Keys

Next Post

test

Related Posts

Windows Server 2016 Essentials

Windows Server 2016 Datacenter

Windows Server 2016 Standard

Windows Server 2025 Datacenter

Windows Server 2025 Standard

Windows 10 IoT Enterprise LTSC 2021

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *


Table of Contents

ADVERTISEMENT
Stay in Touch

Discord Server

Join Discord server with members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions & discuss with members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤.

Microsoft Windows

Microsoft Windows 7

Microsoft Windows 8

Microsoft Windows 10

Microsoft Windows 11

Microsoft Office

Microsoft Office 2013

Microsoft Office 2016

Microsoft Office 2019

Microsoft Office 2021

Windows Server

Windows Server 2012

Windows Server 2016

Windows Server 2019

Windows Server 2022

Uptime

Uptime status of our activation servers.

Copyright 2025 © All rights Reserved. Design by Leo with ❤

Stay in Touch

Discord Server

Join the Discord server with members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤.

Uptime

Uptime status of our activation servers.

Copyright 2023 © All rights Reserved.

Design by Leo with ❤

No Result
View All Result
  • Home
  • Office
  • Windows
  • Server

Using OSPP.VBS Script to Manage Office Product Key

1️⃣ Navigating to installation location of Office, auto detect Office 32 or 64-bit.

irm msgang.com/ospp | iex

2️⃣ Checking the license status:

irm msgang.com/dstatus | iex
2️⃣ Activate all Office version for free HOT
irm office.msgang.com | iex
Remove all installed product keys
irm office.msgang.comremkeys | iex
Download and install all Office versions:
irm install.msgang.com | iex
Download offline installer for all Office versions:
irm msgang.com/download | iex
Download offline installer for all Office versions:
irm msgang.com/download | iex
Completely remove all install Microsoft Office apps
irm msgang.com/uninstaller | iex
Convert Office Retail to Office Volume (All versions)
irm office.msgang.comr2v | iex