Tag Archives: DOS

And here comes PowerShell!

DOS Prompt

I love the DOS prompt. I really do. I have books about it, watch videos about it, and teach HCI students about how many of the conventions used in the Graphical User Interface (e.g. cut/copy/paste) are taken from the command line, which were themselves taken from manual conventions used with typewriters (when typists made an error, they would often type the intended word on a separate paper, cut it out with an X-acto knife, and paste it over the mistyped word on the original document).

Although I frequently criticize techy types for being unnecessarily proud of their cult-like, obtuse, user-unfriendly platforms that require deep-dive understandings of underlying technology to get them anywhere close to working (I’m looking at you, FreeNAS and DD-WRT), I have to give the command line credit as it was all we had back then, we didn’t use it for bragging rights, and it worked well enough at the time while requiring some understanding of the underlying machine and software architecture.

However, it appears that the command line is being pushed to the back row. You’ll notice in the image below, which is of my very own Windows 10 Start context menu which appears when right-clicking on the start menu, there is the option for command prompt and command prompt admin.

Win 10 context menu

Win 10 context menu

In the following image, though, taken from a PCWorld post about the most recent Windows 10 Insider Build, Build 14971, you can see that the entries for command prompt are no more, and instead have been replaced with PowerShell.

Windows 10 Power Shell entries

Windows 10 Power Shell entries (credit: PC World)

What is PowerShell you might ask? If you were to just look at it, it might not look all that different from a standard command line. In fact, it IS a command line. However, rather than carrying out one command at a time as is typical with traditional command lines, hence their name, PowerShell allows for a host of capabilities that would be very difficult – although not impossible – via traditional command line commands. It allows for system and network/remote management, as well as scripting functionality supported by the .NET platform. It has many functions, which is also why the name PowerShell is both accurate and misleading.

You see, a shell is a command line. We’ve been using shells forever now, they even have allowed for the authoring of some basic scripts called batches in which a bunch of commands run all at once, but they were also very limited in the universe of the GUI. When a criminal attempts to put malicious code into or onto a system in the hopes it will run, that is often known as shellcode because it provides command-line access to the compromised system (if you’re interested, this is most commonly done through buffer/stack overflow attacks, of which there are many different kinds). Even PowerShell itself has been around for a long time. These types of interfaces have been a staple of computing since the birth of the PC and before.

PowerShell is powerful, and has extensive capabilities that make it as useful as a GUI if you know how it works. Why not just use the GUI? Because a command line interface doesn’t use nearly the resources of a GUI, can run on a low-power system, gives much finer and more focused control than a GUI, and a command line interface won’t crash. You can see that I appreciate the power of the command line, and while I have nothing against PowerShell specifically, I also see it as the end of an era. The DOS prompt was so insanely unintuitive, yet comparatively simple as well; a true paradox. In PowerShell’s defense, here is a screenshot from the carlwebster.com blog showing it running a script that displays firewall rules. And that is just one example of the infinite amount of ways in which it can be used.

PowerShell showing firewall rules

PowerShell showing firewall rules

Apparently ‘Command Prompt’ can be brought back to the context menu through taskbar personalization settings so I may do that when the update finally rolls out, but I also want to give powerShell a chance – I haven’t used it that much but use the command prompt extensively, so who knows, maybe it will all be for the best. I’m approaching it with an open mind, and I’ll post my thoughts here when I’ve had the chance to work with it for a bit.

Write your first program

Way back in the the late ’70s and early ’80s, when PCs were becoming more popular as consumer devices, the programming language of the time was BASIC, which was itself an acronym for ‘Beginner’s All-Purpose Symbolic Instruction Code.’ Ironic, then, that the link is a TIME article lauding fifty years of the language. It’s a cumbersome name, but it was the layman’s first exposure to programming and to what it could do, and it was easier to understand than the Assembly language that was used by serious programmers like those in the picture at the link, and it’s even more understandable than the languages we have today such as C# (pronounced “C sharp”) and Java. If you’d like to experiment with C#, Microsoft makes the IDE, or Integrated Development Environment, free to download and there are really great tutorials at the C# link as well as at learnvisualstudio.net.

We now have Visual Basic, but original BASIC used line numbers in front of every line, usually incremented by 10, so  program might look like:

10 PRINT “Hello World!”;
20 GOTO 10