Project:Sandbox

= Introduction = In this wiki testing project we are going to learn something about coding. In this text there is

no "mainstream", in fact it includes just parts I want to add at the moment, just for fun. I want

to thank John Landells for showing me this sandbox page, so I can

learn about creating a wiki for my current project at Frankfurt, Germany = CMD Scripting example = We will see a short example about cmd scripting.

What is CMD ?
You will read a very short introduction to the Windows command line shell. The Windows command line is a mainstay for systems administrators and power

users but is relatively unknown to many PC users. The purpose of this site is to make the power

and utility of the command line more familiar to a wider community of computer users. Also

under-appreciated are the related resources of batch files and scripts and these will be

discussed as well.

Windows is famous as a graphical user interface and many computer users tend to forget (or never

knew) that there are also very useful command line functions in Windows. In fact, there is a

great deal more to Windows than just point and click. The keyboard and the command line can be

substantial adjuncts to the mouse and icons. There are two basic features involving a command

line. One is the entry 'Run" (or "Start Search" in Vista) that is in the Start menu and the other

is the command prompt window.

Writing a logging subroutine in CMD Shell
In corporate environments some shell scripts are still written in Command Scripts (CMD). This has

many reasons, f.e. the workers don´t know to use contemporary techniques like powershell or

coroporate systems are based on older technologies. Most people think there is no way to write

subroutines in CMD. In fact, there is a way and you can even add some parameters. It is like

writing jump brands. Let´s investigate the code below. 
 * log

set logtext=%* echo %date% %time% %username%@%computername% %logtext% >> %logfile% The first line with  :log is the same as a jump brand, there is

really no difference. It tells the system to jump to this point during call. The second line  set logtext=%* initiates a parameter handover, so logtext is

equal to the first parameter of the function call. The final line  echo

%date% %time% %username%@%computername% %logtext% >> %logfile% writes date, time, username

and computername and also our logtext to the predefined file logfile. Now we will take a look to

the function call.  call :log %dirinfo% Here the function is called with the parameter dirinfo, which is defined as the local dos

command "dir". =References=