Batchography: Parsing INI files from a Batch file

Often times you might want to write Batch file scripts to automate system administration tasks, and in addition to that you might want to pass configuration files to your Batch scripts.

This article, inspired by the Batchography book, shows you how to parse INI files and retrieve values from a given section and key.

Quick background

An INI file (or initialization file) is a text file that has the following format:

; comment

[section_name1]
Key1Name=Value1
.
.
.
[section_name2]
Key1Name=Value1
Key2Name=Value2
.
.
.

In the MS Windows operating system, a C/C++ programmer can read/write values from the INI files using the following APIs:

But can we do the same using Batch files?

Yes and in the next section, we show you how to read values from the INI file. Continue reading “Batchography: Parsing INI files from a Batch file”

See no evil, hear no evil, speak no evil!

I found this nice picture in an Art book. I wish I remember its name, but if you know then please let me know.

Anyway, usually the “See no evil, hear no evil, speak no evil” is illustrated by 3 monkeys. In the painting below, it is illustrated by Bears. That’s why I found it interesting.

According to Wikipedia, there are three differing explanations of the meaning of “see no evil, hear no evil, speak no evil”:

  1. In Buddhist tradition, the tenets of the proverb are about not dwelling on evil thoughts.
  2. In the Western world both the proverb and the image are often used to refer to a lack of moral responsibility on the part of people who refuse to acknowledge impropriety, looking the other way or feigning ignorance.
  3. It may also signify a code of silence in gangs, or organized crime.

You might also like:

3 Easy steps to interactively debug Go code with Visual Studio Code in Windows

If you are like me, then you like to be able to write code and develop both from the same integrated environment. Microsoft’s Visual Studio is my favorite IDE. Not long ago, Microsoft released a new free editor called VS Code. It is a powerful editor that is highly configurable and customizable (with extensions).

In this blog post, I am going to illustrate how to set up VS Code in order to debug source code written in the Go language.

Step 1 – Installing the Go language support

First, install the Go language on your computer from here: https://golang.org/dl/

If you did not install VS Code before, install it from here: https://code.visualstudio.com/Download

From inside VS Code, install the Go language extension by clicking on the extensions icon and then searching for “Go” and installing it.

Press the “Reload” button once the extension is installed. Continue reading “3 Easy steps to interactively debug Go code with Visual Studio Code in Windows”