MS Club of SLIIT
Published in

MS Club of SLIIT

What is batch language?

Batch is a programming language. It is used to create script files executable on Windows operating system. Normally, normally these files have an extension of .bat or *.cmd. When being executed, they open a "Command Prompt" window, which normally has a typical black background, white text.

The batch files (*.bat, *.cmd) are called script files which can contain commands interfering operating system.

Batch uses @rem to start a Comment line, which is used to annotate the purpose of command lines in the program and they are ignored when the program excutes.

To start Batch language, we create a file with the hello.bat name, and write statements showing on the screen the line of "Three", "Two", "One", "Hello World!".

You can also execute Batch file from CMD. Open the CMD and CD programs to go to the folder containing the file to be executed.

@echo on/off

The @echo off command is used to stop the command prompt display mode. This mode is on by default. Let's see the difference between @echo off and @echo on by the following illustration:

What is a variable?

Variable is a basic concept in computer science. It is a value that can change. Like other languages, Batch also has the concept of variable.

Basically, Batch has 2 kinds of variables:

Variables are declared in a file through the set command.

Argument variables are passed from outside when the file is called for execution.

Common variables

Batch language does not have a clear concept of data type. Normally, a variable has the value that is a string, including characters after the = sign to the end of the line. (Including whilte spaces if applicable).

In case you want to declare a variable which is a number, you need to use the set /A statement

To access value of a variable, you must enclose it in % signs

--

--

--

A student-driven community based on SLIIT aiming to bridge the skill gap between an Undergraduate and an Industry Professional

Recommended from Medium

Creating a Banking API, Part 1

Game Dev Digest Issue #128 — Procedural Generation

Issue #128 - Procedural Generation

MediaQuery & CSS

How do I open a new Google Play developer account after the termination of the old account?

Software Development Relativity Is an Invisible Force That Warps Software Projects

GSoC 2022 with OpenMRS : Week 01

Software Development at the Edge of Chaos

What is CSS Flex box?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Madhusha Prasad

Madhusha Prasad

Open Source Enthusiast | Full Stack Developer👨🏻‍💻 | JavaScript & Type Script , Git & GitHub Lover | Undergraduate — Software Engineering‍💻 | SLIIT👨🏻‍🎓

More from Medium

Behavior Driven Development in Vue with Cypress and Cucumber

Nested loop part-2

Programming Languages: Pick Your Poison (C++ vs Python vs Java)

Functions in Pythonn!!!