Sunteți pe pagina 1din 14

http://pcsupport.about.com/od/commandlinereference/tp/command-prompt-commands-p1.htm http://www.computerhope.com/msdos.htm http://www.7tutorials.com/command-prompt-advanced-commands-system-information-managingactive-tasks http://www.techrepublic.

com/blog/10things/10-windows-7-commands-every-administrator-shouldknow/2718

Afisare configurare conexiune (Display Connection Configuration): ipconfig /all Afisare cache DNS (Display DNS Cache Info Configuration): ipconfig /displaydns Curatare cache DNS (Clear DNS Cache): ipconfig /flushdns Terminarea tuturor conexiunilor IP (Release All IP Address Connections): ipconfig /release Reinoirea conexiunilor IP (Renew All IP Address Connections): ipconfig /renew Re-inregistreaza conexiunile DNS (Re-Register the DNS connections): ipconfig /registerdns Afisare informatii clasa DHCP (Display DHCP Class Information): ipconfig /showclassid Schimba/Modifica DHCP class ID (Change/Modify DHCP Class ID): ipconfig /setclassid Conexiuni retea (Network Connections): control netconnections

Setare retea (Network Setup Wizard): netsetup.cpl Testare conexiune (Test Connectivity): ping www.adresameaip.ro Trasare ruta IP (Trace IP address Route): tracert www.adresameaip.ro Afisare sesiuni TCP/IP (Displays the TCP/IP protocol sessions): netstat Afisare ruta locala (Display Local Route): route Afisare adresa MAC (Display Resolved MAC Addresses): ARP vine de la Address Resolution Protocol Afisare nume calculator (Display Name of Computer Currently on): hostname /? - utilizat dupa comenzi iti va afisa sectiunea de Ajutor privind comanda respectiva.

arp

Windows Command Prompt in 15 Minutes There are only a few Command Prompt commands that you will need to master to make it through COS 126. The following is a brief tutorial covering the most important ones.

What is Command Prompt?

The Command Prompt program allows you to work in an environment that looks more like a traditional operating system as opposed to the icon based Windows environment. In Command Prompt, you will use your keyboard. You won't use your mouse at all. Command Prompt works at a lower level than Windows. This means that you will have more control over the machine. The disadvantage is that it is less userfriendly. You will need the command prompt in COS 126 to compile and execute your Java programs. Learning the Command Prompt also provides a gradual transition to Unix and Linux systems, which are prevalent in science, engineering, and industry. To launch Command Prompt select Start -> Run and type cmd in the box. The Command Prompt shows up as a black terminal window. The command prompt should look something like:
C:\>

This is where you type commands. The boldface type below (that follows the command prompt) is what you should type as you work through this tutorial. Windows does not care if you use upper or lower case. That means that command cd is the same as CD. It also means that, in Windows, file HelloWorld.java is the same as helloworld.java. This is NOT true in the system to which you will be submitting your files. Be very careful!!!
Some Useful Commands

javac: To compile a Java program, use the javac command. Your program should compile without any errors or warnings (or if there are warnings be absolutely sure that they do not indicate a flaw in your program).
C:\>javac HelloWorld.java

java: To run a successfully compiled Java program, use the java command.
C:\>java HelloWorld

more: Display the contents of a file one screenful at a time.


C:\>more HelloWorld.java

exit: Exit the Command Prompt program and close the terminal window.
C:\>exit

Working with Files and Directories

You can also use Command Prompt commands to organize files into a directory hierarchy. These commands are equivalent to corresponding commands that you access via the Windows point-and-click interface. It is useful to be familiar with both interfaces for managing files.

dir: To view the contents of a directory, type dir. This command will list all the files and directories within the current directory. It is analogous to clicking on a Windows folder to see what's inside.
C:\> dir Volume in drive C has no label. Volume Serial Number is C8C7-BDCD Directory of C:\ 10/26/2004 10/26/2004 02/10/2005 12/09/2004 02/10/2005 11/02/2004 12/29/2004 01/13/2005 01:36 PM 0 AUTOEXEC.BAT 01:36 PM 0 CONFIG.SYS 01:36 PM 126 HelloWorld.java 12:11 AM DIR Documents and Settings 08:59 PM DIR introcs 08:31 PM DIR j2sdk1.4.2_06 07:15 PM DIR Program Files 07:33 AM DIR WINDOWS 3 File(s) 126 bytes 5 Dir(s) 32,551,940,096 bytes free

There are 7 items in this directory. Some of them are files, like HelloWorld.java. Others are directories, like introcs.

cd: It is frequently useful to know in which directory you are currently working. In order to find out, type cd at the command prompt.
C:\> cd C:\

To change directories, use the cd command with the name of a directory.


C:\> cd introcs

Now, the command prompt will be:


C:\introcs>

To see what is in this directory type:


C:\introcs> dir Volume in drive C has no label. Volume Serial Number is C8C7-BDCD

Directory of C:\introcs 02/10/2005 02/10/2005 02/03/2005 01/17/2005 08:59 PM DIR 08:59 PM DIR 11:53 PM 01:16 AM 2 File(s) 2 Dir(s) . .. 126 HelloWorld.java 256 readme.txt 382 bytes

To return to the previous directory, use the cd command, but this time followed by a space and two periods.
C:\introcs> cd .. C:\>

mkdir: To create a new directory, use the command mkdir. The following command creates a directory named hello, which you can use to to store all of your files associated with the Hello World assignment.
C:\introcs> mkdir hello

To see that it actually worked, use the dir command.


C:\introcs> dir Volume in drive C has no label. Volume Serial Number is C8C7-BDCD Directory of C:\introcs 02/10/2005 02/10/2005 02/11/2005 02/03/2005 01/17/2005 08:59 PM DIR 08:59 PM DIR 02:53 PM DIR 11:53 PM 01:16 AM 2 File(s) 3 Dir(s) . .. hello 126 HelloWorld.java 256 readme.txt 382 bytes

move: Now, move the two files HelloWorld.java and readme.txt into the hello directory using the move command.
C:\introcs> move HelloWorld.java hello C:\introcs> move readme.txt hello C:\introcs> dir Volume in drive C has no label. Volume Serial Number is C8C7-BDCD Directory of C:\introcs 02/10/2005 02/10/2005 02/11/2005 08:59 PM 08:59 PM 02:53 PM DIR DIR DIR . .. hello

0 File(s) 3 Dir(s)

0 bytes

The two files are no longer visible from the current directory. To access the two files, change directories with the cd command. Then use the dir command to see what is in this new directory.
C:\introcs> cd hello C:\introcs\hello> dir Volume in drive C has no label. Volume Serial Number is C8C7-BDCD Directory of C:\introcs\hello 02/10/2005 02/10/2005 02/03/2005 01/17/2005 08:59 PM DIR 08:59 PM DIR 11:53 PM 01:16 AM 2 File(s) 2 Dir(s) . .. 126 HelloWorld.java 256 readme.txt 382 bytes

You can also use move to rename a file. Simply specify a new filename instead of a directory name. Suppose you accidentally messed up the upper and lower case and had saved HelloWorld.java as helloworld.java. Use two move commands to fix it.
C:\introcs\hello> dir Volume in drive C has no label. Volume Serial Number is C8C7-BDCD Directory of C:\introcs\hello 02/10/2005 02/10/2005 02/03/2005 01/17/2005 08:59 PM DIR 08:59 PM DIR 11:53 PM 01:16 AM 2 File(s) 2 Dir(s) . .. 126 helloworld.java 256 readme.txt 382 bytes

C:\introcs\hello> move helloworld.java temp.java C:\introcs\hello> move temp.java HelloWorld.java C:\introcs\hello> dir Volume in drive C has no label. Volume Serial Number is C8C7-BDCD Directory of C:\introcs\hello 02/10/2005 02/10/2005 02/03/2005 01/17/2005 08:59 PM DIR 08:59 PM DIR 11:53 PM 01:16 AM 2 File(s) . .. 126 HelloWorld.java 256 readme.txt 382 bytes

2 Dir(s)

It takes two moves because Windows won't let you move to an already existing filename and, to Windows, helloworld.java is the same as HelloWorld.java.

copy: To make a copy of a file, use the copy command. The following command creates a backup copy of our HelloWorld.java program. This is especially useful when you modify a working program, but might want to revert back to the original version if your modifications don't succeed.
C:\introcs\hello> copy HelloWorld.java HelloWorld.bak C:\introcs\hello> dir Volume in drive C has no label. Volume Serial Number is C8C7-BDCD Directory of C:\introcs\hello 02/10/2005 02/10/2005 02/03/2005 01/17/2005 08:59 PM DIR 08:59 PM DIR 11:53 PM 01:16 AM 2 File(s) 3 Dir(s) . .. 126 HelloWorld.java 256 readme.txt 382 bytes

del: Subsequently, you might want to clean up useless files. The del command deletes a file.
C:\introcs\hello> del HelloWorld.bak C:\introcs\hello> dir Volume in drive C has no label. Volume Serial Number is C8C7-BDCD Directory of C:\introcs 02/10/2005 02/10/2005 02/03/2005 01/17/2005 08:59 PM DIR 08:59 PM DIR 11:53 PM 01:16 AM 2 File(s) 3 Dir(s) . .. 126 HelloWorld.java 256 readme.txt 382 bytes

WARNING: When you revise a file in jEdit, the jEdit program will automatically save a backup copy of your original file in the same directory. The name of the backup file will be the name of the original file with a ~ at the end. When you submit your program be careful to submit HelloWorld.java and not HelloWorld.java~ which is an old version of the file and has the wrong name.

wildcards: You can also apply the copy, del, and move commands to several files (or directories) at once. To create a new directory called loops, and copy all of the files in the hello directoryC:\introcs\hello\ into this newly created directory type:
C:\introcs> mkdir loops C:\introcs> copy c:\introcs\hello\* loops

Here the * matches all files in the C:\introcs\hello directory. It copies them to your newly created loops directory.
Redirection

Two important abstractions in Command Prompt are standard input and standard output. By default standard input is your keyboard, and standard output is your computer screen. For example, in Assignment 1, we write a program CenterofMass.java that reads input using StdIn.java and writes output using System.out.println(). To run our program, the user types the command "java CenterofMass" and enters double type values in triplets: xposition yposition mass from the keyboard. The results appear in the terminal window.
C:\introcs\loops> java CenterofMass 0 0 10 1 1 10 0.5 0.5 20

Redirecting standard input. As an alternative, we can create a file that consists of the same six input numbers. Using a text editor (like jEdit), create a file named input.txt, and type in the six numbers. After saving the file in the loops directory, type the following command to verify that you entered the integers correctly:
C:\introcs\loops> more input.txt 0 0 10 1 1 10

Then to read the integers from the file instead of the keyboard, we use the redirection symbol "<".
C:\introcs\loops> java CenterofMass < input.txt 0.5 0.5 20

This produces exactly the same result as if the user had typed the numbers, except that the user has no opportunity to enter numbers from the keyboard. This is especially useful for two reasons. First, if there are lots of input values (there are over 700 inputs for Assignment 2) it would be tedious to retype them

in each time we run our program. Second, it allows programs to be automated, without waiting for user interaction. This means that your grader can process your homework programs without typing in the input values by hand each time.

Redirecting standard output. Similarly it is possible to redirect the output to a file instead of to the screen. Continuing with the same example, if we want to save the output permanently, we can use the output redirection symbol '>'.
C:\introcs\loops> java CenterofMass > output.txt 0 0 10 1 1 10

The user still types in the input values from the keyboard, but instead of sending the output to the screen, it is sent to the file named output.txt. Note that all printf output is sent to the file, even the statement that tells the user what to do. Be careful, if the file output.txt already exists, it will be overwritten. (To append use '>>' instead.)
phoenix.Princeton.EDU% more output.txt

Redirecting standard input and standard output. It is often useful to use both redirection operations simultaneously.
C:\introcs\loops> java CenterofMass < input.txt > output2.txt

After executing this command, no output appears on the screen, but the file output2.txt now contains exactly the same data as output.txt above.

Piping

Another useful abstraction is piping. Piping is when the output of one program is used as the input of another program. For example, suppose we want to view the output of a program, but there is so much that it whizzes by on the screen too fast to read. (The program RandInts.java prints out a bunch of random integers.) One possible way to accomplish this is to type the following two commands.
C:\introcs> java RandInts > temp.txt C:\introcs> more < temp.txt

Note that more will work by redirecting the file temp.txt to standard input (as is done here) or by simply using the filename (as is done at the beginning of the document). Instead, we could do this in one line using the pipe symbol '|'
C:\introcs> java RandInts | more

This is often useful when debugging a program, especially if your program goes into an infinite loop and you want to see the first few values that it prints.

hortcut to commands

&& - Command Chaining %SYSTEMROOT%\System32\rcimlby.exe -LaunchRA - Remote Assistance (Windows XP) appwiz.cpl - Programs and Features (Formerly Known as "Add or Remove Programs") appwiz.cpl @,2 - Turn Windows Features On and Off (Add/Remove Windows Components pane) arp - Displays and modifies the IP-to-Physical address translation tables used by address resolution protocol (ARP) at - Schedule tasks either locally or remotely without using Scheduled Tasks bootsect.exe - Updates the master boot code for hard disk partitions to switch between BOOTMGR and NTLDR cacls - Change Access Control List (ACL) permissions on a directory, its subcontents, or files calc - Calculator chkdsk - Check/Fix the disk surface for physical errors or bad sectors cipher - Displays or alters the encryption of directories [files] on NTFS partitions cleanmgr.exe - Disk Cleanup clip - Redirects output of command line tools to the Windows clipboard cls - clear the command line screen cmd /k - Run command with command extensions enabled color - Sets the default console foreground and background colors in console command.com - Default Operating System Shell compmgmt.msc - Computer Management control.exe /name Microsoft.NetworkAndSharingCenter - Network and Sharing Center control keyboard - Keyboard Properties control mouse(or main.cpl) - Mouse Properties control sysdm.cpl,@0,3 - Advanced Tab of the System Properties dialog control userpasswords2 - Opens the classic User Accounts dialog desk.cpl - opens the display properties devmgmt.msc - Device Manager diskmgmt.msc - Disk Management diskpart - Disk management from the command line dsa.msc - Opens active directory users and computers dsquery - Finds any objects in the directory according to criteria dxdiag - DirectX Diagnostic Tool eventvwr - Windows Event Log (Event Viewer) explorer . - Open explorer with the current folder selected. explorer /e, . - Open explorer, with folder tree, with current folder selected. F7 - View command history find - Searches for a text string in a file or files findstr - Find a string in a file firewall.cpl - Opens the Windows Firewall settings

fsmgmt.msc - Shared Folders fsutil - Perform tasks related to FAT and NTFS file systems ftp - Transfers files to and from a computer running an FTP server service getmac - Shows the mac address(es) of your network adapter(s) gpedit.msc - Group Policy Editor gpresult - Displays the Resultant Set of Policy (RSoP) information for a target user and computer httpcfg.exe - HTTP Configuration Utility iisreset - To restart IIS InetMgr.exe - Internet Information Services (IIS) Manager 7 InetMgr6.exe - Internet Information Services (IIS) Manager 6 intl.cpl - Regional and Language Options ipconfig - Internet protocol configuration lusrmgr.msc - Local Users and Groups Administrator msconfig - System Configuration notepad - Notepad? ;) mmsys.cpl - Sound/Recording/Playback properties mode - Configure system devices more - Displays one screen of output at a time mrt - Microsoft Windows Malicious Software Removal Tool mstsc.exe - Remote Desktop Connection nbstat - displays protocol statistics and current TCP/IP connections using NBT ncpa.cpl - Network Connections netsh - Display or modify the network configuration of a computer that is currently running netstat - Network Statistics net statistics - Check computer up time net stop - Stops a running service. net use - Connects a computer to or disconnects a computer from a shared resource, displays information about computer connections, or mounts a local share with different privileges(documentation) odbcad32.exe - ODBC Data Source Administrator pathping - A traceroute that collects detailed packet loss stats perfmon - Opens Reliability and Performance Monitor ping - Determine whether a remote computer is accessible over the network powercfg.cpl - Power management control panel applet qfecheck - Shows installed Hotfixes applied to the server/workstation. quser - Display information about user sessions on a terminal server qwinsta - See disconnected remote desktop sessions reg.exe - Console Registry Tool for Windows regedit - Registry Editor rasdial - Connects to a VPN or a dialup network robocopy - Backup/Restore/Copy large amounts of files reliably rsop.msc - Resultant Set of Policy (shows the combined effect of all group policies active on the current system/login) runas - Run specific tools and programs with different permissions than the user's current logon provides sc - Manage anything you want to do with services.

schtasks - Enables an administrator to create, delete, query, change, run and end scheduled tasks on a local or remote system. secpol.msc - Local Security Settings services.msc - Services control panel set - Displays, sets, or removes cmd.exe environment variables. set DIRCMD - Preset dir parameter in cmd.exe start - Starts a separate window to run a specified program or command start. - opens the current directory in the Windows Explorer. shutdown.exe - Shutdown or Reboot a local/remote machine subst.exe - Associates a path with a drive letter, including local drives systeminfo -Displays a comprehensive information about the system taskkill - terminate tasks by process id (PID) or image name tasklist.exe - List Processes on local or a remote machine taskmgr.exe - Task Manager telephon.cpl - Telephone and Modem properties timedate.cpl - Date and Time title - Change the title of the CMD window you have open tracert - Trace route whoami /all - Display Current User/Group/Privilege Information wmic - Windows Management Instrumentation Command-line winver.exe - Find Windows Version wscui.cpl - Windows Security Center wuauclt.exe - Windows Update AutoUpdate Client

Written by Jake Brenner, Donna Gabai and Kevin Wayne.

10 Windows 7 commands every administrator should know


By Brien Posey December 27, 2012, 12:00 AM PST

Takeaway: The command line is often the best place to resolve Windows 7 desktop problems. These basic commands will help speed your troubleshooting tasks. Holiday rerun: An oldie-but-a-goodie, these command-line basics topped the list of popular troubleshooter posts last year. PC troubleshooting is becoming less common in larger organizations, but consultants and techs in smaller shops still have to get their hands dirty identifying and fixing desktop problems. Oftentimes, troubleshooting Windows 7 means delving into the command line. Here are 10 fundamental Windows 7 commands you might find helpful.

Before I begin
This article is intended solely as an introduction to some useful troubleshooting commands. Many of them offer numerous optional switches, which I wont cover here due to space limitations. You can find out more about each command by checking out TechNets command-line reference.

1: System File Checker


Malicious software will often attempt to replace core system files with modified versions in an effort to take control of the system. The System File Checker can be used to verify the integrity of the Windows system files. If any of the files are found to be missing or corrupt, they will be replaced. You can run the System File Checker by using this command:
sfc /scannow

2: File Signature Verification


One way to verify the integrity of a system is to make sure that all the system files are digitally signed. You can accomplish this with the File Signature Verification tool. This tool is launched from the command line but uses a GUI interface. It will tell you which system files are signed and which arent. As a rule, all the system files should be digitally signed, although some hardware vendors dont sign driver files. The command used to launch the File Signature Verification tool is:
sigverif

3: Driverquery
Incorrect device drivers can lead to any number of system problems. If you want to see which drivers are installed on a Windows 7 system, you can do so by running the driverquery tool. This simple command-line tool provides information about each driver that is being used. The command is:
driverquery

If you need a bit more information, you can append the -v switch. Another option is to append the -si switch, which causes the tool to display signature information for the drivers. Heres how they look:
driverquery -v driverquery -si

4: Nslookup
The nslookup tool can help you to verify that DNS name resolution is working correctly. When you run nslookup against a host name, the tool will show you how the name was resolved, as well as which DNS server was used during the lookup. This tool can be extremely helpful when troubleshooting problems related to legacy DNS records that still exist but that are no longer correct. To use this tool, just enter the nslookup command, followed by the name of the host you want to resolve. For example:
nslookup dc1.contoso.com

5: Ping
Ping is probably the simplest of all diagnostic commands. Its used to verify basic TCP/IP connectivity to a network host. To use it, simply enter the command, followed by the name or IP address of the host you want to test. For example:
ping 192.168.1.1

Keep in mind that this command will work only if Internet Control Message Protocol (ICMP) traffic is allowed to pass between the two machines. If at any point a firewall is blocking ICMP traffic, the ping will fail.

6: Pathping
Ping does a good job of telling you whether two machines can communicate with one another over TCP/IP, but if a ping does fail, you wont receive any information regarding the nature of the failure. This is where the pathping utility comes in. Pathping is designed for environments in which one or more routers exist between hosts. It sends a series of packets to each router thats in the path to the destination host in an effort to determine whether the router is performing slowly or dropping packets. At its simplest, the syntax for pathping is identical to that of the ping command (although there are some optional switches you can use). The command looks like this:
pathping 192.168.1.1

7: Ipconfig
The ipconfig command is used to view or modify a computers IP addresses. For example, if you wanted to view a Windows 7 systems full IP configuration, you could use the following command:
ipconfig /all

Assuming that the system has acquired its IP address from a DHCP server, you can use the ipconfig command to release and then renew the IP address. Doing so involves using the following commands:
ipconfig /release ipconfig /renew

Another handy thing you can do with ipconfig is flush the DNS resolver cache. This can be helpful when a system is resolving DNS addresses incorrectly. You can flush the DNS cache by using this command:
ipconfig /flushdns

8: Repair-bde
If a drive that is encrypted with BitLocker has problems, you can sometimes recover the data using a utility called repair-bde. To use this command, you will need a destination drive to which the recovered data can be written, as well as your BitLocker recovery key or recovery password. The basic syntax for this command is:
repair-bde <source> <destination> -rk | rp <source>

You must specify the source drive, the destination drive, and either the rk (recovery key) or the rp (recovery password) switch, along with the path to the recovery key or the recovery password. Here are two examples of how to use this utility:
repair-bde c: d: -rk e:\recovery.bek repair-bde c: d: -rp 111111-111111-111111-111111-111111-111111

9: Tasklist
The tasklist command is designed to provide information about the tasks that are running on a Windows 7 system. At its most basic, you can enter the following command:
tasklist

The tasklist command has numerous optional switches, but there are a couple I want to mention. One is the -m switch, which causes tasklist to display all the DLL modules associated with a task. The other is the -svc switch, which lists the services that support each task. Heres how they look:
tasklist -m tasklist -svc

10: Taskkill
The taskkill command terminates a task, either by name (which is referred to as the image name) or by process ID. The syntax for this command is simple. You must follow the taskkill command with -pid (process ID) or im (image name) and the name or process ID of the task that you want to terminate. Here are two examples of how this command works:
taskkill -pid 4104 taskkill -im iexplore.exe

S-ar putea să vă placă și