views:

43

answers:

3

Hi,

I am very interested in learning windows shell programming. So...I searched for books on the amazon.com. I see that books on the amazon.com are out of date. Most of books are published before 2005. I googled about it and found many tips and tricks, but not step by step guide.

Where do I get started?

P.S: I am talking about windows shell programming that I do on visual c++. I am not talking about windows shell script.

A: 

Dear terrani,

From your previous questions and answers, I guess that you have Visual Studio and PHP experience, which means that you have probably known what does it mean by a "variable" and control flows like a "for loop".

So I guess you are more focused into the syntax of the Windows shell. I would like to say that, in fact, the syntax of "Windows shell script" (or, batch files) has changed only a little bit since the last version of MSDOS (which is, 6.22). So, if you don't mind, I think the "before 2005" books are new enough for you.

To get some hands-on experience, you may try the command prompt by yourself. To get a list of all commands supported by cmd.exe, you may type HELP /?. To list all available options of a command, type /? after the command name. For example, DIR /? gives you a description of the DIR command, as well as its available options. You may also seek help from the official references here. You may read the output of HELP /? first to get a brief idea on what you can do with the commands. Then, you may try the commands you are interested by viewing its help first.

After you have some basic understandings, reading batch files written by somebody else would help, especially for the more advanced parts like ERRORLEVEL handling. Please search your computer for files ending with .bat. Visual Studio bundles some batch files, please try to understand them.

In my opinion, you may begin with the following commands: DIR, COPY, DEL, MOVE, ECHO, TYPE and XCOPY.

Please feel free to comment if this solution is not good enough.

Asuka Kenji

Siu Ching Pong - Asuka Kenji
+1  A: 

I would suggest you have a look at Windows Powershell, that allows you to create shell scripts using the .NET framework. There is plenty of documentation online and a there are several books available as well. A good starting point would be Microsoft Script Center.

pilsna
The Windows Powershell looks more like the POSIX shell (or somebody calls it UNIX shell) than the built-in shell (aka. `cmd.exe`). It is not installed in a standard installation.
Siu Ching Pong - Asuka Kenji
Windows Powershell is an integral part of Windows 7 and Windows Server 2008 R2, and available as a separate download for Windows XP, Windows Vista and Windows Server 2003.
pilsna
@SiuChing While various *nix shells influenced PSH, there is also heavily influence from DCL (the VMS shell) and others. And of course, completely unlike *nix shells, the pipeline is objects, not strings.
Richard
A: 

The following site is the best online reference I have found - http://ss64.com/nt/.

Bermo
It's just a duplication of the official documentation here: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true
Siu Ching Pong - Asuka Kenji
Did you have a close look - it certainly is not just a duplication. Of course it looks similar - they are both referring to the the same thing!
Bermo