Standard Commands


A standard installation of Windows includes a number of command-line tools that are extremely useful. Table A.1 describes a few of them. For a complete list of all command-line programs provided with Windows , scan through the programs listed with type CMD in Appendix B, " Windows Command Reference."

Table A.1. Important Standard Command-Line Commands

Command

Description

 

control

Opens and runs a control panel from the command line. For details, see the section named, "control," in Chapter 9, "Windows Commands and Scripting."

findstr

Searches through text files for specified strings. (If you're familiar with UNIX or Linux, findstr is like grep.) For more information, see "findstr," in Chapter 9.

ftp

Copies files to and from other computers using the Internet's File Transfer Protocol. You can use the FTP command-line program to post files to a web server, retrieve files from a UNIX host, or perform other file-copying tasks . Type ftp and press Enter, and the program will prompt you to enter commands. The most important commands are:

 

open hostname

Establishes a connection to the specified computer

 

binary

Indicates that the files to be transferred are binary (data) files; use for images and programs

 

ascii

Indicates that the files to be transferred are text files; use for text and HTML files

 

cd dirname

Changes directories on the remote computer

 

lcd dirname

Changes directories on the local (your) computer

 

dir [ filename ]

Lists the directory on the remote computer

 

!dir [ filename ]

Lists the directory on your computer

 

send filename

Transfers the specified file from your computer to the other computer

 

get filename

Retrieves the specified file from the other computer to your computer

 

mput filename

Sends multiple files; use wildcards in the filename

 

mget filename

Gets multiple files; use wildcards in the filename

 

prompt

mget and mput normally prompt you for a yes/no response before transferring each file; prompt toggles this prompting on or off

 

quit

Terminates the connection

iexpress

IExpress is a wizard that builds a simple setup program for software you've developed yourself. You have to provide the one or more files that comprise your application, and a configuration file that describes where these files are to be copied on the target computer. Additionally you can define Registry entries that are to be made, and you can designate a program or script that is to be run after the files are copied onto a target computer to complete the installation. IExpress then compresses all of this into a single executable ( .EXE ) file that you can distribute and run on other computers.

ipconfig

Ipconfig displays IP address configuration information for your computer's network adapters. Additionally it can release or renew the adapter's DHCP lease, although the GUI "repair" option on the Network Connections control panel is more thorough. Type ipconfig /help for syntax information.

net

The net command can perform quite a number of chores, from creating local user accounts, to mapping network drives , to viewing the resources shared on a remote computer, to sharing folders. For more information about net, see the section named, "net," in Chapter 9.

netsh

netsh is a complex, interactive program that can configure and display just about every aspect of Windows networking. You can work with netsh interactively or give it commands from a batch file or script. For syntax information, type netsh then help . Exit with quit .

nslookup

nslookup is an interactive program that lets you query Domain Name Service (DNS) servers. nslookup is particularly useful for finding information about the ownership of IP addresses. The syntax is the same as the UNIX versions from which it came. To find out the hostname of a given IP address, type

 

nslookup xxx.yyy.zzz.qqq

 

replacing xxx, yyy, zzz , and qqq with the corresponding parts of the IP number in question. If this does not produce an answer, type the following commands:

 

nslookup

 

set type=ANY

 

zzz.yyy.xxx.in-addr.arpa .

 

yyy.xxx.in-addr.arpa .

 

exit

runas

runas runs a command under another user's credentials. It's like the UNIX utility su, and is most often used to run a management tool as Administrator. The program run can be GUI or command-line, and if you specify cmd as the command, you get a command prompt window from which you can run any other programs. The syntax is

 runas /user:  xxx "command"  

 

where xxx is the login name of the user whose credentials you want to use. The three ways I use it most often are

 
 runas /user:Administrator "control firewall.cpl" runas /user:Administrator cmd 

 

and

 
 runas /user:Administrator mmc 

 

(For setup and installation programs, it's usually easier to locate the program in Explorer, right-click, and select Run As.)

ping

ping tests network connectivity by sending data packets to another computer on your network or on the Internet, and reports whether the data got through or not. It's a valuable diagnostic tool. For syntax information type ping /? .

 

Perhaps the most useful command-line switch is -t . This will keep ping pinging until you interrupt it with Ctrl+C, a very handy thing if you're trying to fix network cabling or find a problem with your network setup.

tasklist

Lists running applications and services. Available on XP Pro and Media Center Edition only [*] . tasklist can provide detailed information about the services provided by running applications, and can list tasks running under other logins (due to Fast User Switching). Type tasklist alone on the command line for a list of programs or tasklist /? for syntax help.

taskkill

taskkill kills the program(s) specified on the command line, and it can often kill errant programs that the Windows Task Manager cannot. Available on XP Pro and Media Center Edition only [*] . Type taskkill /f /pid ### to forcibly terminate a program with process ID number ###; or type taskkill /? for a list of all options.

tracert

tracert probes the path between your computer and another computer on your network or the Internet, listing each intermediate network router in between the two. It's an important diagnostic tool. Type tracert /? for a syntax description.


[*] For some reason, Microsoft chose not to install tasklist.exe and taskkill.exe on Windows XP Home Edition. If you use XP Home, you might want to grab copies of these two useful tools from the \windows\system32 folder of an XP Pro or XP Media Center Edition installation.




Upgrading and Repairing Microsoft Windows
Upgrading and Repairing Microsoft Windows (2nd Edition)
ISBN: 0789736950
EAN: 2147483647
Year: 2005
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net