1.8 KiB
+++ title = "Creating a batch (.bat) file in windows" tags = ["windows"] +++
On windows a Batch file simply a text document with the file extension .bat
rather than .txt
.
Step 1. Create a new file
To create a batch file, simply right click and hover over New
then press Text Document
.
![papermc download]({{< static "post-img/windows-create-txt-file.png" >}})
Step 2. Set the file name to end with .bat
With the new file created, enter the name run.bat
. You should get a warning confirming you want to change the name extension, press yes.
![rename to run.bat]({{< static "post-img/rename-to-run-bat.png" >}})
![confirm rename]({{< static "post-img/confirm-rename.png" >}})
Step 3. Edit the Batch file
Just like a text document, you can edit the batch file in Notepad. This can be done by right clicking on the file and selecting Edit
.
![confirm rename]({{< static "post-img/windows-edit-bat-file.png" >}})
Fixing Problems
Make sure the file type is correct
Make sure the file type is a Windows Batch File
file.
![windows batch file ext good]({{< static "post-img/windows-batch-file-type-good.png" >}}) ![windows txt file ext bad]({{< static "post-img/windows-text-file-type-bad.png" >}})
If the file type is Text Document
you'll need to enable viewing file extensions and rename the file.
Turn the .txt file into a .bat file
To do this, click the View
tab on the top of your file explorer.
![windows explorer view]({{< static "post-img/windows-file-explorer-view.png" >}})
Then make sure File name extensions
is checked.
![view file name ext]({{< static "post-img/windows-explorer-view-file-ext.png" >}})
Now you can go ahead and rename the file so it ends with .bat
.
![rename to run.bat]({{< static "post-img/rename-to-run-bat.png" >}})
![confirm rename]({{< static "post-img/confirm-rename.png" >}})