Skip to toolbar

Windows batch scripting basics in 2020

Spread the love
25 / 100
Reading Time: < 1 minute

Hey, imagine that you open your computer’s shell. And then you write a command. Question: What happens? And what was maybe supposed to happen?

Computers are known to be quite fragile.

More than physically wearing out or actually “breaking” a computer, you’re likely to possibly mess things up a bit. Messing happens often by:

  • typo in command (a spell error)
  • running wrong command
  • running a command that was given by someone intentionally, in an attempt to fool you
  • running a bad command – that you saw on a web page

Don’t worry. Let’s supercharge you with knowledge on these commands and the shell!

use ‘which’ in cmd

Check what your command would do, beforehand.

With shell, we can always use where command

What is a computer shell?

A shell is just another program. It’s written to take in commands, and do stuff. Shells are convenient and powerful tools. They are operated by writing commands.

Shell scripts can in addition run anything that you can write interactively, plus scripts have a few extra powerful things:

  • IF statements (allows you to make logic)
  • loop structures (run thousands of things at once, fast)
  • variables (make complex things possible)

Try the shell commands

A command looks like this:

echo Hi!

Let’s try the “echo” command in an actual Windows shell.

In Windows, first open a shell:

  • press Alt+R
  • enter ‘cmd‘ in the box
  • press enter

Now you should see a rather black and dull looking shell window. Write, using keyboard, ‘echo Hi!’, and press Enter. So just write the text e,c,h,o and space and then capital H and i followed by exclamation character (Shift+1).

The shell says back Hi!

You have used an internal shell command on Windows. See you soon!

Facebook Comments

Published by jukkasoft

Hi! A bit updated description. Code enthusiasta, technology optimist, but also a realist. In my blog I wrote 80% of technology related articles, mostly in English and Finnish. I like to envision and ponder about things, how life could be, what we are doing wrong today, and so on. "Invented" a facebook -like system in 2000, as a short product pamphlet. Haven't yet realized the 20+ ideas that might have become big things. Maybe learning this skill one of these days!

Leave a Reply

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

%d bloggers like this: