I plan to start learning shell scripting but I want to start with the one I can use. Is there anyway to find out which type and version of shell program XP uses?

Is it DOS, PowerShell?

Recommended Answers

All 4 Replies

go to start, run, type in cmd and press ok.
you'll get a black window with the version number and everything.

Thanks for the reply Comatose.

This is what I get: Microsoft Windows XP [Version 5.1.2600] But this can't be the shell program, is it? I thought it was something like PowerShell or Dos or something. Or maybe I've got the whole concept wrong. Mybe shell programs are universal? I'm a total noobie so if you could give me a few details that would be helpful and appreciated.

Alright, let me give you the break down. Typically when people refer to shell scripting they refer to *nix only. You don't shell script in windows. In windows you can write a batch file... in windows you can write a "script", usually known as WSH (Windows Scripting Host), VBS (VBScript), or JScript (Microsoft's hacked up version of javascript). When people talk about "shell scripts" though, they are referring to scripts that work on a specific shell in unix / linux.

I guess some definitions are in order. The shell is an old term that pretty much means an interface for the users. In XP, it would be accurate to say that explorer.exe (not internet explorer, explorer.exe is the program that provides you with a start button and a desktop) /IS/ the graphical shell. I'm guessing this came about, because it protects the OS from you, and shields you from it.

A Script, is a file that has programming in it. A Script does not need to be compiled into machine language prior to it being run.... this happens when you run the script, on the fly. This is an important distinction between a scripting language, and a "programming language." A programming language needs a separate program, which is used to turn what the programmer types into machine code. This program is called a compiler. Scripts don't need this program, because there is a different program that translates the code into machine language, which runs at the same time you run the script (usually called an interpreter).

So generally, a "shell script" can be any script (non-compiled program) that is interpreted by the shell (user interface). However, this is simply not the case when talking with someone informed about them. In Linux, you can basically use a different shell than the one provided. In windows, you are pretty much stuck with the "command prompt" or "dos prompt". You get a c:\>, and are stuck with the limited functionality provided by command.com or cmd.exe. In Linux, you can decide to use a different shell, or even write your own. There are a list of linux shells, but by large the most used is "Bash", which stands for "bourne again shell", and allows you some nifty features (such as pressing the "up" arrow key to scroll through your list of typed commands).

It's important to mention that shell-scripts are usually command-line oriented. A distinction is drawn between "script" and "shell-script", because a "script" is interpreted by the language interpreter. For example, "Perl" is a scripting language, and requires the "perl" executable program for a perl script to run. A Shell script, however, is interpreted by the shell, and requires no additional program to interpret it.

People "in the know", will only refer to "shell scripts" as linux based scripts that are interpreted by the shell, and is usually assumed to be the "bash" shell, unless otherwise noted (for say, C shell, or Tcsh or whatever). In windows, they may refer to a script, but never as a "shell-script". The equivalent beast in windows/DOS is called a batch file.

I strongly suggest you look into installing Cygwin, which is a linux like environment for windows (command line). This however, is really a poor substitute from actually sitting with a linux machine. If your machine is powerful enough, you could install Virtualbox which is basically like having an OS inside of your real OS. You could install linux in that, and then learn shell scripting that way.

Sorry for the long winded reply, there is just so much information to cover regarding shell scripts.

commented: Nice answer +29

Thank you Comatose, that answered my main question: CMD or Dos is the equivalent of Bash for Windows.

I guess I am now ready to start. Assuming I master batch scripting, will this give total control over my OS? Will I be able to manage windows networks, and other IT tasks? Basically what I want it total control over the OS, I want to be in the drivers seat, kinda of like driving a stick shift.

Also, any recommendation on a book or website to start? Thanks again Comatose for your very helpful replies.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.