Batch coding: The best scripting for starters
For a year or two now I have been developing different programs in my free time. It all started when I tried making a message box pop up in Visual Basic Script. I was successful so I went on and made a message box creator with some more tools that I could find along the way. This all seems good right? But it is not all good. Visual Basic script is very weird with how it is formatted and does not have the most friendly environment for new coders. So I went on a journey. Looking at command prompt one day I wondered if I could use that to make a cool little contraption. This is what I found.
Batch is not your everyday coding language, here is why I say that. Batch does not require anything special to write with. What I did for the first month or so was I just used plain notepad and was able to write just about as much as someone who has visual basic studio! But here is the thing. Batch does not have any custom window. When you launch a batch script, you have a black rectangle open up in the top right corner of your screen unless you change the launch position. Even though batch is really powerful and can do just as many tasks as the user itself, you cannot really make the window look really professional or flashy. So to fix that I took on some ASCII formatting.
To make a good look for your program requires some skill. The most used way that people use to do this is by taking equal signs and placing them like barriers to make the text look like this.
Here is the text on the inside
Some more text
[user enters command here]
When you are using a method like that, it really helps out with making the look of the program seem to be more professional, even though it probably isn’t in the first place.
…………………..Why batch is so good with computers……………………
There are many good reasons that batch can be so helpful to Windows users in general. Here are some good examples:
- It can preform basically everything the user can
- The commands are simple and easy
- You can create your own commands and inputs
- There are typically descriptions of why something isn’t working
- Filework is very simple
- It can preform basically everything the user can:
Since batch is made in the Windows command shell, it is a pretty powerful tool if you use it correctly. With batch you can easily batch complete filework (hence called batch), you can write and display different things for the user to read, and you can also send out commands to powershell if something is not in the batch command directory.
2. The commands are simple and easy:
“Writing’s not that easy.” A quote by Grammarly heard about almost every day. The same thing applies to coding. If a language is too hard for someone, they will most likely move on to the next language or completely stop it all. Batch on the other hand provides simple commands that can easily be written by anyone that knows how to type. Here are some good commands that are the most useful when writing batch:
@echo “your text here” - displays a message
mkdir “name” - creates a folder in the desired directory.
cd “filepath” - puts the shell in a folder so that you don’t need to specify what folder you want stuff in
These are just a few of the many commands that can be used in command prompt that are very simple to remember and learn for new users.
3. You can create your own commands and inputs:
With most languages it is hard to figure out how to make your own commands and inputs that the user can use. With batch it is different. Batch is all about typing and buttons do not exist, so you can have all the fun making cool commands and making them do cool things.
Here is a good example of how to make a command
- Put a dash before it
- Make it not too long
The result will be great and easy for your impressed user.
4. There are typically descriptions of why something is not working:
Batch has a good setup where you do not need to worry that much about bugs. But when there are bugs, it is easy to avoid them by getting some advice from the shell. When you put an improper command in batch, it will tell you what you did wrong in a nice and simple way that anyone can use.
5. Filework is very simple:
Since batch is made to operate a Windows computer, you can do some pretty cool stuff with it, like advanced and easy filework that takes two seconds at most. Batch provides different shortened paths so that you do not need to take your time to type c:\users\user\ so on and so on. Instead of typing that you would simply type %userprofile%\ so that 1. It takes less time and 2. It is universal so you do not need to worry about other people’s paths not collaborating with your program.
Hopefully this was helpful to you if you are a developer or thinking about being a developer. Anyways if you like content like this make sure to subscribe or follow, it’s free, and you can always unsubscribe if you do not like my content. I won’t normally be plugging my stuff like this so please if you like my content be sure to consider following. Anyways have a great day and see you in the next post.
Thanks if you got all the way down this was a long post