Breaking
January 26, 2026

7 Useful Batch Files You Can Create to Automate Tasks on Windows 11 Hallie Frederick | usagoldmines.com

You’ll be able to automate many duties in your Home windows 11 PC utilizing batch information. I’ll clarify what a batch file is, how one can create one, and present you some attention-grabbing and helpful makes use of of those information.


What Is a Batch File?

A batch file is a file that incorporates a number of instructions to be executed subsequently. As an alternative of typing these instructions in Command Immediate or PowerShell, you create a file that runs these instructions every time the file is launched. This allows you to accomplish the duties of these instructions.


A batch file makes use of “.bat” as its file extension. You run batch information the identical manner you run different information—merely double-click a file to launch it. No third-party apps are wanted to open batch information.

Create a Batch File

Making a batch file is as simple as making a plain textual content Notepad doc. You create a brand new file in a plain text editor, add the instructions you need, and save the file as a batch file. Your system will run the file the identical manner no matter the way it was created so long as it’s a correct batch file.


To create a batch file on Home windows 11, open Home windows Search (press Home windows+S), sort Notepad, and launch the app. Sort the instructions you need your file to have. The next sections have some helpful instructions that you need to use to automate your duties.

After getting into the instructions, from Notepad’s menu bar, choose File > Save As (or press Ctrl+Shift+S). Within the Save As window, select the situation to avoid wasting your batch file. Click on the “Save as Sort” drop-down menu and choose “All Recordsdata.” Choose the “File Title” area, sort a reputation to your batch file, add “.bat” on the finish of the file title so it’s a batch file, and click on “Save.”

The "Save As" dialog box for saving a batch file.


Your batch file is now prepared. To run it, double-click the file. If a batch file requires administrative privileges (like those that delete short-term information), right-click the file and select “Run as Administrator.” Be sure to decide on “Sure” within the Consumer Account Management immediate.

"Run as Administrator" highlighted for a batch file.

Should you all the time wish to run a batch file as an admin (so that you don’t should right-click the file and select “Run as Administrator” every time), right-click the batch file and select Present Extra Choices > Ship To > Desktop (Create Shortcut).

Proper-click the newly created shortcut and choose “Properties.” Entry the “Shortcut” tab, click on “Superior,” allow “Run as Administrator,” select “OK,” and choose “Apply” adopted by “OK.”

"Run as Administrator" and "OK" highlighted for a batch file.


And that’s it.

Emptying the Recycle Bin

You may make a batch file that automatically clears all the contents of the Recycle Bin. This frees up your space for storing and declutters your machine.

To do this, use the next instructions in a batch file.

This batch file requires administrator privileges to run it.

@echo off
echo Emptying Recycle Bin for all drives...
powershell -Command "Clear-RecycleBin -Pressure -ErrorAction Ignore"
echo Recycle Bin emptied.
pause
The batch file to empty the Recycle Bin.

You’ll see the Recycle Bin Emptied message when the duty is finished.

Clearing Momentary Recordsdata

Eradicating short-term information helps you free up your storage space and declutter your pc. The next instructions enable you to try this.

Be sure to run this file as an admin to keep away from working into any errors.


@echo off
echo Clearing Momentary Recordsdata...
del /q /f /s %temp%*
rd /s /q %temp%
echo Momentary information cleared.
pause
The batch file to delete the temporary files.

Launching A number of Apps at As soon as

Should you usually launch sure apps one after one other, you may create a batch file that automatically launches all those apps for you. You’ll be able to specify the apps to be launched within the instructions.

@echo off
echo Launching apps...
begin explorer
begin chrome
begin "" AppPath
echo All apps launched.
pause
The batch file to launch multiple apps at once.

As you may discover, the above script launches File Explorer and Google Chrome utilizing their system names. To launch one other app, substitute “AppPath” with the complete path to the executable file of the app you wish to launch. Be sure to surround the trail in double quotes.


Again Up Recordsdata and Folders

To again up sure information and folders, you can also make a batch file that mechanically copies gadgets from one supply and pastes these gadgets at one other path.

@echo off
echo Backing up information...
xcopy "SourcePath" "DestinationPath" /e /i /h /y
echo Backup accomplished.
pause
The batch file to back up files and folders.

On this script, substitute “SourcePath” with the trail the place you wish to copy gadgets from. Substitute “DestinationPath” with the trail the place you wish to save the information.

Right here, the “/e” parameter ensures the empty folders are copied as effectively. The “/i” parameter creates the vacation spot folder if it doesn’t exist already. The “/h” parameter copies hidden information. The “/y” parameter overwrites information with out prompts

Reset Community

Typically when you run into network problems, resetting your pc’s IP handle and flushing the DNS cache helps repair points. You should use the next code in a batch file to carry out these duties.

This batch file requires working as an administrator to perform.


@echo off
echo Resetting community...
ipconfig /launch
ipconfig /renew
ipconfig /flushdns
echo Community reset accomplished.
pause
The batch file to reset the network.

This file releases your pc’s present IP handle, requests a brand new IP handle out of your router’s DHCP server, and flushes your DNS cache.

Create a System Restore Level

Making a system restore point is necessary for those who’re going to make any important modifications to your system. This restore level means that you can undo your modifications in case one thing goes flawed.

You should use the next instructions in a batch file to automate the method of making a restore level. Within the code, be happy to interchange “RestorePointName” with the title you want.

It is advisable run this batch file as an administrator.


@echo off
echo Creating System Restore Level...
wmic.exe /Namespace:rootdefault Path SystemRestore Name CreateRestorePoint "RestorePointName", 100, 7
echo System Restore Level created.
pause
The batch file to create a system restore point.

Swap Between Darkish and Mild Mode

Home windows 11 has each darkish and lightweight modes, and you’ll create batch information to change between these modes.

It is advisable run these information as an administrator as these information change a worth within the Home windows registry.

To switch to dark mode, you’ll use the next instructions:

@echo off
reg add "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionThemesPersonalize" /v AppsUseLightTheme /t REG_DWORD /d 0 /f
echo Switched to Darkish Mode.
pause
The batch file to enable dark mode.

To change to gentle mode, you’ll use the next code:

@echo off
reg add "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionThemesPersonalize" /v AppsUseLightTheme /t REG_DWORD /d 1 /f
echo Switched to Mild Mode.
pause

You’re achieved.



And that’s the way you automate many standard duties utilizing batch information in your Home windows 11 pc. The chances are countless, as you may enter any instructions you need in batch information and automate any duties you need.

 

This articles is written by : Nermeen Nabil Khear Abdelmalak

All rights reserved to : USAGOLDMIES . www.usagoldmines.com

You can Enjoy surfing our website categories and read more content in many fields you may like .

Why USAGoldMines ?

USAGoldMines is a comprehensive website offering the latest in financial, crypto, and technical news. With specialized sections for each category, it provides readers with up-to-date market insights, investment trends, and technological advancements, making it a valuable resource for investors and enthusiasts in the fast-paced financial world.