back to article Welcome, stranger: Inside Microsoft's command line shell

PowerShell is everywhere, it seems. Not just in Windows Server, SharePoint, SQL Server, Exchange, Lync and Azure cloud, but it’s in third-party software, too. Take VMWare PowerCLI – that’s an extension of PowerShell. With many in the Windows world chewing on this fat PowerShell server software sandwich it’s easy to take …

Silver badge
Linux

GUIs can be great ...

Ongoing argument with my penguin mad brother over preferring GUIs - in *some* situations.

Because a good GUI can help a great deal towards presenting a quick logical overview of what on earth it is you are doing. You can grey out controls, or link them so that you know selecting an option requires addition parameters. You can also ensure mutually exclusive commands can never be issued. And you can provide tooltips to assist in more obscure or lesser used options. Best of all you tend to work in generics, rather than specifics - you want the outcome to be "Delete temporary files on completion" - or is it -B ? -D ? --delete-temp-files-on-exit ? --cleanup ?

However, I do like Linux, so --->

3
0

Repetitive, mind-numbing menial tasks are IMPORTANT

It's what stops uppity 2nd-line people from developing ideas above their station.

0
0
Bronze badge

Re: Repetitive, mind-numbing menial tasks are IMPORTANT

It's what stops uppity 2nd-line people from developing ideas above their station.

Bare Windows® gives me the feeling I have a teaspoon to hammer a nail in a wall. UnxUtils is a lifeline, Cygwin a must and WinBatch fun.

BTW after 10000+ day as UNIX-superuser I do not trust anybody with that power, including myself. Cmd.exe is more benign.

1
0

re: Windows XP was the first PC operating system to drop the MS-DOS

So what happened to Windows 2000 Professional and Windows NT3.5/4 Workstation - which were all PC OSes (and used on PC not server)

5
0
Silver badge

Re: re: Windows XP was the first PC operating system to drop the MS-DOS

I think he meant the first consumer-facing system. They ran in parallel with 95/98/ME and were intended for serious applications (proper 32-bit programs, multi-user, etc).

Sadly in the push to make consumer & professional lines converge and be fast enough for gaming, compatible with older badly written software (some of it MS' of course!), etc, a lot of dumb decisions were made w.r.t. security, etc.

0
0
Bronze badge

Re: re: Windows XP was the first PC operating system to drop the MS-DOS

NT3.1 introduced CMD.EXE (aka Command Prompt).

0
0
Bronze badge

Re: re: Windows XP was the first PC operating system to drop the MS-DOS

Also, I think he messed up about Windows ME ??? - one of the great complaints about it was that it wasn't possible to just "boot into a pure MS-DOS prompt by pressing the right start-up bypass keys", because they had removed that feature ???

0
0

Re: re: Windows XP was the first PC operating system to drop the MS-DOS

Happy to be corrected, but I don't think so:

http://www.mdgx.com/msdos.htm

0
0

Re: re: Windows XP was the first PC operating system to drop the MS-DOS

The same paragraph explained that:

Windows XP was the first PC operating system to drop the MS-DOS Prompt and change it to Command Prompt, due to a change to the NT kernel. The Windows NT family has used the newer Command Prompt since it started with Windows NT 3.1, so it was nothing new on that side of the fence.

0
0

Re: The same paragraph explained that:

But XP derived from NT not Dos & Windows 95 - it was the first version of the NT family sold without NT label.

0
0
Silver badge

Funny thing is ...

... those of us who were already using UNIX[tm] in the early-mid 1980s found MS-DOS's command.com to be a brain-dead command interpreter. To this day, Microsoft hasn't really figured the concept out. IMO, of course.

14
4

Back in the 90's I used to teach courses on how to get the most amount of memory out of 640Kb. I also wrote DOS programs (anyone remember EasyEdit - the best text edtor at the time (so Byte said)) which used overlays to move stuff in and out of extended memory to leave the most free real memory.

It was fun in those days. Windows has dumbed us all down.

Alan

4
0
Silver badge
Facepalm

"Windows has dumbed us all down."

Indeed. I'm sure we've all heard:

  • Have you tried switching it off and on again?
  • Yeah that file is corrupt, you need to reinstall the whole operating system
  • Yeah, all computers slow down if you don't reboot them every few days, and rebuild them once a month

1
1
Silver badge

@ Alan Sharkey

I just fired up my 1988 386sx16, math-co, 8megs, 40meg, 1meg on VLB video card ... DOS 5.0 (mouse driver loads high automatically! [was HUGE back then ...]), DESQview, QEMM, Windows 3.0, Lotus, dBaseIII+, WP ... Still runs nicely, is pretty snappy, even. Windows ran nicely under DESQview, but it seemed rather pointless ...

The "640K should be enough" attributed to Bill Gates is a myth. On the original IBM PC, MS/PCDOS could use 760K(ish) of so-called "low-mem", before it ran into IBM's built-in hardware stoppage. Which was an IBM hardware issue, not a Microsoft coding issue. Eventually, we figured out how to use nearly 950K of low-mem.

The real "should be enough" quote was from Steve Jobs, when demoing the original Apple Macintosh at the Home Brew Computer Club, a couple weeks before the official unveiling. He said, and I quote, "256K should be more than enough for home users" ... and he had a point. We had flight simulators running in 64K of RAM back then.

EasyEdit? I've been using vi from time immemorial ...

Sometimes I look at the modern world and despair over the sheer waste ...

1
3
Silver badge

Re: @ Alan Sharkey

> On the original IBM PC,

On the _original_ IBM PC (5150 Model A) it would only support 256Kb max, no mattter how many cards you could afford. Base memory was 16Kb for ROM BASIC and Cassette port. Model B (I have one here) supported max 640Kb.

> MS/PCDOS could use 760K(ish) of so-called "low-mem", before it ran into IBM's built-in hardware stoppage.

IBM reserved the areas above 640Kb for hardware adaptor memory. The CGI card occupied addresses at 640Kb. If only a MDI or hercules card was used then another 64Kb could be used to give 704Kb. Anything beyond that required memory management hardware such as an EMS or EEMS card that could switch address spaces around.

However, later MS-DOS (5 or later), DR-DOS, QEMM or others on a 286 or later could emulate EMS and could shift the OS into high memory or beyond 1Mb.

> Eventually, we figured out how to use nearly 950K of low-mem.

Not on a 8088 based PC or PC XT you didn't. There were machines that could support almost the full addressable 1Mb of a 8086/8088. SCP Zebra series for example, or other S100 bus based systems. The Sharp MZ-5600 that I have here also could utilise 512Kb for OS and programs the other 512Kb address space was reserved.

I do have other 8088/8086 machines that can use the full 1Mb but they run Concurrent-CP/M-86 on several serial terminals.

> Which was an IBM hardware issue, not a Microsoft coding issue. Eventually, we figured out how to use nearly 950K of low-mem.

1
0
Silver badge

Re: @ Alan Sharkey

"On the _original_ IBM PC (5150 Model A) it would only support 256Kb max"

You never piggy-backed RAM, Richard Plinston?

0
1

From /In the Beginning was the Command Line/ by Neal Stephenson

[...] Note the obsessive use of abbreviations and avoidance of capital letters; this is a system invented by people to whom repetitive stress disorder is what black lung is to miners. Long names get worn down to three-letter nubbins, like stones smoothed by a river.

This is not the place to try to explain why each of the above directories exists, and what is contained in it. At first it all seems obscure; worse, it seems deliberately obscure. When I started using Linux I was accustomed to being able to create directories wherever I wanted and to give them whatever names struck my fancy. Under Unix you are free to do that, of course (you are free to do anything) but as you gain experience with the system you come to understand that the directories listed above were created for the best of reasons and that your life will be much easier if you follow along (within /home, by the way, you have pretty much unlimited freedom).

After this kind of thing has happened several hundred or thousand times, the hacker understands why Unix is the way it is, and agrees that it wouldn't be the same any other way. It is this sort of acculturation that gives Unix hackers their confidence in the system, and the attitude of calm, unshakable, annoying superiority captured in the Dilbert cartoon. Windows 95 and MacOS are products, contrived by engineers in the service of specific companies. Unix, by contrast, is not so much a product as it is a painstakingly compiled oral history of the hacker subculture. It is our Gilgamesh epic.

What made old epics like Gilgamesh so powerful and so long-lived was that they were living bodies of narrative that many people knew by heart, and told over and over again--making their own personal embellishments whenever it struck their fancy. The bad embellishments were shouted down, the good ones picked up by others, polished, improved, and, over time, incorporated into the story. Likewise, Unix is known, loved, and understood by so many hackers that it can be re-created from scratch whenever someone needs it. This is very difficult to understand for people who are accustomed to thinking of OSes as things that absolutely have to be bought.

http://steve-parker.org/articles/others/stephenson/oral.shtml

12
0
Anonymous Coward

Re: From /In the Beginning was the Command Line/ by Neal Stephenson

+1 for the Neal Stephenson reference. I have a copy on my bookshelf.

1
0

Which is to say...

The point being, important lessons were learned building the Unix shell. Yes there's cruft too -- it's over 40 years old. But it's polished smooth, for all that.

PowerShell learns few of those lessons.

George Santayana said: "Those who do not remember the past are condemned to repeat it."

Henry Spencer modified this to: "Those who do not understand Unix are condemned to reinvent it, poorly."

Microsoft is still learning to reinvent Unix -- slowly separating text-mode core OS from graphical layer; learning the importance of a rich command line; learning to write graphical commands that emit said CLI, easing automation. But it's not doing it terribly well.

The trouble is that the Stockholm Syndrome world of corporate IT has been brainwashed into believing that it's the only way and to frantically deny the Great Heresy that is Unix.

17
0
Anonymous Coward

Re: Which is to say...

"slowly separating text-mode core OS from graphical layer"

More accurate to write: "slowly reseparating". Recall that Cutler's team started with text-mode before Bilge ordered the GUI bolted on regardless.

3
0

Re: Which is to say...

Microsoft is still learning to reinvent Unix -- slowly separating text-mode core OS from graphical layer; learning the importance of a rich command line; learning to write graphical commands that emit said CLI, easing automation. But it's not doing it terribly well.

You could say the same thing in reverse for Linux and the desktop. I can't recall the number of flavors of Linux GUI/Apps I've tried over the years just to toss them out because they were too much hassle to make work.In the end, as a consumer of a desktop OS, I want to use it for productivity.

Ubuntu is the latest trend and it is getting better, but I would never throw it at my users.

And managing users in nix is a joke. LDAP is the king, and MS has the single best implementation of that technology to date.

Back on topic, Unix systems have had, hands down, the best command line power for decades. At this point, I'd say PowerShell is getting MS to where it needs to be to be a serious tool for command line junkies. But it sure wasn't there to begin with!

1
5
Roo
Silver badge
Windows

Re: Which is to say...

"More accurate to write: "slowly reseparating". Recall that Cutler's team started with text-mode before Bilge ordered the GUI bolted on regardless."

As good as some of Cutler's work has been and as smart as he is, I feel people are a bit too quick to put him on a pedestal when it comes to WNT.

1) I would fully expect WNT to development to have started out with "text-mode" - simply because developing all those graphics drivers, GUIs and supporting libraries would have taken a very long time. I would *expect* Cutler et al to have debugged & interacted with those early kernels via "text-mode" over a RS232 port, or perhaps via VGA card (text only - natch).

2) When Cutler was hired & developing NT, GUIs were the thing people wanted to buy, therefore he should have known up front that a GUI would be the main way of interacting with the new OS, he would have to have been deaf dumb, blind and terminally retarded not to see which way the wind was blowing at Redmond. To give Cutler his due, I am fairly certain he would have had a big problem with a lot of aspects of the bits outside of the Kernel on WNT, and would agree that WNT would have looked totally different if Cutler had full control over it's development... Pretty sure he would have strangled Win32 in it's cot for starters. ;)

The reason why OSes & drivers were often developed in "text-mode" is driving an RS-232 interface or VGA card doesn't require much in the way of code and there is very little to go wrong with it. For those reasons a lot of UNIXen, their admins & users have carried on using "text-mode". That said I fully expect pretty much any Linux distro to boot into a GUI and work by default these days. ;)

1
0
Roo
Silver badge
Windows

Re: Which is to say...

"LDAP is the king"...

Sure, and it's been available for UNIX boxes forever...

1
1

Having had a Unix and proprietary mainframe

upbringing, and micros at home, I am less than impressed by Microsoft's efforts on the shell and command-line fronts.

After all, there was clearly a fight over whether or not to continue it at all. Nice to see that sanity prevailed.

That said, its roots in DOS are very clear, it isn't much good as a consequence. Also, useful.

1
1

Not dead yet

Curously, there seems to be evidence that the command prompt in Windows still has a tiny spark of life in it. (Or maybe I'm late discovering features in the obscure and hard-to-find documentation.) "set /?" now delivers three screens of help, and includes features like string replacement and delayed variable expansion. You can write surprisingly capable scripts now. Unfortunately there seems to be some rule that any new feature has to be invoked by obscure metacharacters. I suspect that this is a legacy of the original feeble MS-DOS parser.

I'm reasonably sure that the first versions of MS-DOS did offer command-line editing. It used function keys F1 to F9(?) and it's still available in Windows 7, although some of the functions now produce a popup prompt which obviously wasn't there in MS-DOS.

1
0
Vic
Silver badge

Re: Not dead yet

I'm reasonably sure that the first versions of MS-DOS did offer command-line editing.

I don't remember a version that didn't - although I might simply have forgotten some...

The early stuff used F1-F3; F1 would repeat the next character in the history buffer. F2 and a character would repeat up until the next occurrence of that character (and ISTR you could prefix a number to repeat up until the nth occurrence), and F3 would repeat the whole line.

Vic.

2
0
Bronze badge

Re: Not dead yet

>seems to be some rule that any new feature has to be invoked by obscure metacharacters.

Not the legacy of the original feeble MS-DOS parser -- it's the legacy of ALGOL, as also seen in powershell, combined with legacy of people who are single-finger typists.

Some people like FORTRAN and COBOL because they can type. Some people like obscure metacharacters because they can't.

1
0

They say imitation is the sincerest form of flattery

It's nice to see that Microsoft is finally catching up to where Unix was, circa 1975 :-)

6
3
Trollface

That's awkward...

<tab;&gt, is a bit of a complicated completion command sequence to remember - by the time you'd typed all that you could have written the whole command out instead!

4
0
Silver badge
Facepalm

Written badly

"Windows XP was the first PC operating system to drop the MS-DOS Prompt and change it to Command Prompt, due to a change to the NT kernel. The Windows NT family has used the newer Command Prompt since it started with Windows NT 3.1, so it was nothing new on that side of the fence."

All versions of NT from 3.1 to the 5.1 (XP) had choice of 32bit native console (looked like a DOS prompt) or running MSDOS shell via NTVDM (Real DOS prompt).

NT also could run OS/2 scripts and console executables as well as native NT scripts.

MS Services for Unix (1999) added Bourne Shell to NT4.0

2
0
Linux

Powershell

Behaves more like a base scripting language (a summary of the worst of bash, php and perl)

Then you get application extensions to provide extra functionality for the base scripting language to be of any use.

In Unix you have scripting languages and anything that you install/add to the system is already available to anything else that you can call from the shell, or anything that can start a shell, regardless of the language.

Say whatever you want about PowerShell object oriented usage, you will not do much with Exchange objects feeding them to VMWare unless vmware adds support for them, nor you would be able to use those objects on tomorrows latest fart without MS's intervention.

As I said to a Windows colleague once, "Relax; you just have discovered scripting, I was as excited as you when I discovered what you could do with .bat files back in the late 80's"

9
1

'MS-DOS was lacking other features, too, that many would now consider unforgivable. After typing out an incredibly long command and realising there was an extra letter at the very beginning, all you'd end up with was an unusable chunk of text.' - a bit like when you've composed a txt or email then realise you have a spelling error and are sadly using an iPhone instead of a phone with editing capabilities.

4
0

... or you'd hit space, then press F3 to repeat the rest of the command. Not sure what version of DOS that keyboard shortcut was added in, but it's saved me a whole load of typing in the past.

2
0
Bronze badge

all you'd end up with was an unusable chunk of text.'

>After typing out an incredibly long command and realising there was an extra letter at the very beginning, all you'd end up with was an unusable chunk of text.'

except it wasn't actually like that. You just backspace through it, delete the character, then replay the characters.

If you had altready attempted the command, you just use the correct Fn key to replay the very long command, then backspace through it

0
0

UNICODE/UTF8

PowerShell still doesnt support correctly UNICODE/UTF8 characters.

Try pasting 漢字 into it, it wont work (funnily you can even crash PowerShell that way) even with changing the codepage.

PowerShell is maybe better than an old command terminal, it is fine to manage a Windows system, but it is still way far from a really usable terminal window.

I still have to use a Cygwin terminal or some specific terminal (pythonwin) when handling UNICODE/UTF8 and displaying something more useful than lines of ?

3
1
Silver badge

Re: UNICODE/UTF8

That's pretty bad. I understand that Powershell is considered by its users as superior to bash, but at least that's a problem that bash does not have.

I can totally imagine the reasons for which MS would have developed its own rather than going with bash, between the fact bash was considered the competition, that it would have been losing face to adopt it, that they were intelligent enough to create something better, influential enough to get their solution accepted, and so on…

Feels a lot like something Google would do nowadays. MS seems to have grown humble in comparison.

0
1

Re: UNICODE/UTF8

http://stackoverflow.com/a/5808445/465415

1
0
Bronze badge

Bash?

The MS-DOS shell, like most things Microsoft, is just a poor copy of a standard program. In this case its 'sh' or, in Gnuese, 'bash'. Even with teaks and enhancements it doesn't do most of things you can do with a real shell, including starting scripts as programs with the '#!' construct.

If you do a lot of embedded work but you're stuck with a Windows platform (a common scenario) then you find that the tools for the most part are 'ix' based, using Cygwin as a shim to give you something like proper OS functionality. This has the side effect of not only giving you a bash to work with if you need it but also being able to use standard commands directly from the Windows command prompt.

2
2

Upgrading Windows programming with NIX concepts

For more than a decade, most Microsoft Windows users who were totally ignorant about the power and productivity of the Command Line Interface (CLI) and BASH/other Shell scripting tools in *NIX Operating Systems (OS), condemned the non_Windows OS as "stone age" and unsophisticated, not knowing that a significant amount of administrative work and systems configurations were virtually impossible to perform "efficiently and quickly" via any Windows GUI, especially on Windows Servers, Networking operations and for many qpplications progrmming projects in PC desktop envionments.

Most of my Microsoft Windows severe critics from 8 - 10 years back are "now" mentally blank about their earlier views while they take to (painfully) learning and understanding the inevitably of Windows Powershell in modern technology.

My, how times have changed.

5
3
Silver badge

Re: Upgrading Windows programming with NIX concepts

> condemned the non_Windows OS as "stone age" and unsophisticated,

Microsoft worked hard to make their CLI very poor so that they could point out how useless it was in order to convince users to switch to GUI. Even when MS wrote a semi-decent CLI enhancer for Windows 95/98 they didn't install it automatically, didn't mention it in the manual and hid it away.

They even seem to have removed command line options from programs (such as net) so that users were forced to use the GUI rather than have a batch file do stuff automatically.

0
3
Coat

Falcon 3.0, the ultimate test of your config.sys/autoexec.bat skills?

From what I remember from my dim & distant past is that Falcon 3.0 required around 605K of the 640K available to run in AND need access to extended memory. So you needed to load the extended memory driver (himem.sys), a mouse driver (it needed one) and a sound driver enabler into 35k of memory, as well as the core OS...

This was made slightly more, erm, interesting, by the fact that the order in which they were loaded would affect how much memory they took up. Creating bootdisks for Falcon 3.0 was an art!

Kids today..... etc, etc (wanders off mumbling)

2
0

Re: Falcon 3.0, the ultimate test of your config.sys/autoexec.bat skills?

My personal demon was MechWarrior2, which needed to be run off a parallel port connected zip disk because there wasn't room for it on the C drive. Himem, CDRom drivers, Sound drivers, joystick drivers LAN drivers and Zip drive drivers... Took DAYS to finally get that bastard to start.

1
0
Unhappy

config.sys/autoexec.bat fail!

I remember spending Christmas morning struggling with config.sys and autoexec.bat to get 'Magic Carpet' to work on our 386 computer. It had been a present for 10 yr old son; after about 3hrs I just got it to work, by which time son was totally disillusioned.

1
0
Roo
Silver badge
Windows

Re: config.sys/autoexec.bat fail!

"I remember spending Christmas morning struggling with config.sys and autoexec.bat to get 'Magic Carpet' to work on our 386 computer. It had been a present for 10 yr old son; after about 3hrs I just got it to work, by which time son was totally disillusioned."

Funnily enough I'm still going through that nightmare with our < 10 year old kids at the moment. I installed Win 8.1, dutifully slotted in a Disney DVD and waited for it to play... OK, so there's no DVD playback, kicked off a VLC download and figured I'd put on some music from the DLNA server while we waited... Ah of course Win 8.1 doesn't support FLAC presumably because Microsoft can't afford to pay someone nothing to bundle it... As with most prior Windows installs it turned into a really boring afternoon packed with disappointment.

It looks like I've been spoilt by Linux distros. :)

3
1
PJF

Re: Falcon 3.0, the ultimate test of your config.sys/autoexec.bat skills?

Similar situation with an irrigation program..

Needed a mouse, sound, and a 4-color light pen driver to be loaded, before it ate about 600k of the 640. This was on a "true" IBM 286 w/ the 287 math co/pro.

This was the t-o-t-l (top of the line) system - 16 colors, 4-voices, 2-button mouse, and an 84(?) keyboard. Propitiatory 8-bit comm card, and software to drive it, dual UART232 for a dedicated weather station, (on a short-haul modem) and their "custom" mouse/brick (with a "special" pad), Centronics 36 parallel port to a 9-pin (IBM) printer, and a DB-9 to the "largest" (14inch) color display..

Ahh, kids these days... I don't know.. That crap music they play, touch screen this 'n that, social media....

WHEN I WAS A KID......

2
0
Silver badge

command-line programs, such as diskpart,

Was there a DOS diskpart back then? Surely the default MS-DOS tool was fdisk.

2
0

This post has been deleted by its author

Alias

Don't fret, children. You don't really have to type get-childitem to get the contents of a directory. Those memorable commands still work as aliases. You can also type ls. That's what I usually use. I'm thankful they added that in as a default alias. Switching between Linux and Windows systems I used to always manage to type the wrong one... :)

As for the cmd line being dead. It isn't really. You can still type it from the run box or a powershell window and get all your old commands back.

You can also run commands the old fashioned way in PS by using invoke-expression or invoke-command. Then you can do all sorts of nifty management things with it like error control, writing events to log files or the windows event log, etc.

To all of you die hard batch writers, give PS a chance. You may just expand your scripting chops and stay relevant to the IT world while you are at it...

2
3
Silver badge

fondly

"It's easy to look back now and wonder how people put up with such a manual, non-user-friendly system, but personally I still look back on it fondly. Many hours were spent learning every command available, all the switches and what they do."

Yes, indeed. I remember the customer's employee who was working his way through the commands manual one night, and zapped most of the data.

I have done a little scripting with PowerShell, but have not yet warmed to it. I'm not sure why.

0
0

Quote: Windows XP was the first PC operating system to drop the MS-DOS Prompt and change it to Command Prompt, due to a change to the NT kernel. The Windows NT family has used the newer Command Prompt since it started with Windows NT 3.1, so it was nothing new on that side of the fence.

Umm Windows NT 3.5 Workstation, Windows NT 3.51 Workstation, Windows NT 4.0 Workstation and Windows 2000 Professional would like to talk to you behind the bike shed :)

2
0

Page:

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Forums

Biting the hand that feeds IT © 1998–2018