How to create a simple program in Windows with notepad

To create a software you can use different editors, programs created specifically for typing the source language. To be able to use them, some basic knowledge is needed that not everyone has, because they require years and years of study.

If you want to try your hand at an elementary level in creating a program, you can use Notepad. It is an application that is present in all Personal Computers, and that allows you to write texts. Normally, it is not used to create software, also because it is a very simple tool that does not allow to implement sophisticated programs.

But these limits may not be insurmountable if you want to create very basic software. In this guide we will see, precisely, how to create a simple program in Windows with Notepad.

Starting the editor

The Note Pad, or Note Pad, is present in all Personal Computers with Windows, if it is not present on yours, you can download it from the official Micorsoft site, going to update your Windows package.

To find it on your Personal Computer, simply go to? Programs? or use the PC’s internal search engine. If it is present on the computer, clicking on it, the editor will open, and you will be able to insert instructions.

Inserting instructions

Once the text edit is open, the first statement to be typed will be, in our case, @echo off . This word will disable the viewing of the commands – in order to display only the normal and not the coded ones – of your program once it is launched for execution. At this point, go to the top and then type in the sentence you want to be displayed.

It could, for example, be the question ” How are you doing? ” Once this has been done, the response variables to the question must be inserted.

To do this you need to operate in this way: once at the top, type: set/P risp =, then again type again: if [%saving%] == [answer1] echo A.

Again, enter a second variable again: if [% resp%] == [answer2] echo B. Obviously, in the answer post 1, answer 2, A and B you can enter any word, depending on the result you want to get. When typing commands, pay attention to the syntax, because failure to comply with the basic rules would result in blocking the program.

The elementary commands

Another elementary function to use, but which can be useful, is ‘goto’. The ‘goto’ command is used to move from one part of the program to another, just insert a reference after the command. For example, goto: MENU.

Furthermore, to prevent the program from going into a loop and never stopping, it is advisable to use another command, the ” pause “, which, as its name easily suggests, blocks the effects of the software until a key is pressed.

Other interesting commands are? Cls? and? color?. The first one is used to delete the writings already present on the screen, the second one establishes the color of the window. In this case it is necessary to know the codings of the individual colors.

Saving the file

Once you have transcribed the source code of your program, you need to save it. On the top bar select ” File “, then ” Save as “. At that point, it will be sufficient to give a name to the file and indicate the path in which to store it on your hard disk.

The name can be chosen freely, while the extension must necessarily be .bat, otherwise the program will remain a simple text file and not an executable file.

For this reason, while working on the program, but you have not yet completed it, it is convenient to save your work as a text file with an extension .txt. This will make the text completion and modification operations easier and faster. Once the final draft is obtained, the final file can be saved with .bat.

The function test

Once saved with extension. Bat your program will be executable, just click on it to start it. Obviously, the first launch will be used to understand the actual operation of the software, so it will be necessary to open it and see first if it starts. If the screen does not open, then you will have to go back to the file, select ” edit ” and see what is the blocking error.

If, on the other hand, the program starts, it does not necessarily work in all its variables, so you will have to proceed by testing all the different cases that you have foreseen in the programming phase. If one or more functions do not produce the desired results, you will have to go back to the text to correct any errors.

Note : Save the file several times during the writing of the program to prevent your work from being lost due to external causes.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More