1. Home
  2. Windows Tips
  3. Create scripts in notepad on windows 10

How to create scripts in Notepad on Windows 10

A lot of the tips we cover on AddictiveTips involve the use of scripts. Some of these scripts can be used as they are while others need to be modified for individual use cases. Regardless, the script file must nevertheless be created on the system it will run on and we always recommend using Notepad to do the job. Notepad is the stock text editor on Windows 10 and it is basic. You can change the font in Notepad but beyond that, there’s nothing else you can do. The app will always, by default, save files in the TXT format so, here’s how you can use it to create scripts.

Create scripts in Notepad

The trick to creating a script in Notepad is changing the file extension. You need to know two things before you can start. The first is what sort of script it is you’re creating i.e., is it a batch script, a PowerShell script, a VBS script, an AutoHotKey script, or something else. This is important because the type of script determines the file format that you must use. The second thing is, of course, the correct file extension that the script will need to be saved with.

Batch script: BAT

PowerShell script: PS1

VBS script: VBS

AutoHotKey script: AHK

Open a new Notepad file. Paste in the script that you want to create. Use the Ctrl+S keyboard shortcut to save it. This is where you will enter the name of the script, and set its extension. Since we’re using Notepad, it will automatically add ‘*.txt” in the File name box.

The first method you can use to change the extension is to open the ‘Save as type’ dropdown and select ‘All Files (*.*)’ from it. You can then enter the name of the file and its new extension in the File name field e.g., MyScript.ps1.

The second method makes use of double-quotes. You do not have to change any selection in any dropdown. Instead, enter the name of the script and its extension in the File Name field and enclose it in double-quotes (see screenshot below).

The third method involves changing the file extension after you’ve saved the script as a TXT file. Save the script as a text file and then right-click it in File Explorer. Select Rename. Do not change the name. Instead, delete the extension and replace it with the one you want to use. You will see an on-screen alert telling you that changing the extension might make the file unusable. Accept it and the file extension will be changed. The file’s thumbnail will also update for the type of file it is.

Of these three methods, you can pick whatever you want. Notepad isn’t the only tool that you can use to create scripts. In fact, if you need to write a complex script, use Notepad++. It is a far more sophisticated tool that can handle code better than a basic text editor. Notepad is best used for simple scripts and for when you do not have anything else available.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.