| < Day Day Up > |
In a world dominated by whiz-bang graphical
Variables
Arithmetic expressions
Conditional statements
Control flow statements
Procedures
You can use these programming elements to automate repetitive
| < Day Day Up > |
| < Day Day Up > |
Command line scripts are text files containing the commands you want to execute. These are the same commands you would normally type into the Windows command shell. However, rather than enter the commands each time you want to use them, you create a script to store the commands for easy execution.
Because scripts contain standard text
hostname
ver
ipconfig -all
Once you save the script, you can execute it as if it were a Windows utility; simply type the name of the script in a command shell and press Enter. When you do this, the command shell reads the script file and executes its commands one by one. It stops executing the script when it
Listing 3-1: Output of Sample Script
|
|
C:\>hostname
mailer1
C:\>ver
Microsoft Windows [Version 5.2.3790]
C:\>ipconfig -all
Windows IP Configuration
Host Name . . . . . . . . . . . . : mailer1
Primary Dns Suffix . . . . . . . : adatum.com
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : adatum.com
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) PRO/100 VE Network
Connection
Physical Address. . . . . . . . . : X0-EF-D7-AB-E2-1E
DHCP Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.10.50
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.10.1
DNS Servers . . . . . . . . . . . : 192.168.10.155
|
|
If you examine the listing, you’ll see that the command prompt and the actual commands are displayed as well as the output of the commands
Although the default processing mode with command echoing on can be useful for troubleshooting problems in scripts, you probably don’t want to use this display mode with scripts you’ll use regularly. Fortunately, you can change the default behavior by turning command echo off, as I’ll show you later in the chapter in the section titled “Managing Text Display and Command Echoing.”
| < Day Day Up > |