Tag Archives: CMD

Common Command Line Commands – KB1039998

KB1039998

Common Command Line Commands
* Any of these commands can also use the switch /? for help inside Command Line. *
** Not all of these commands need to be run in an Administrator Command Line, but it is suggested to always run CMD as Admin. **
*** There may be additional switches for these commands. These are just the most commonly used switches. ***
Start Command Prompt – Start -> in search field, type “cmd” without quotes -> right click and click Run as Administrator

1. Ping – Sends a request packet to the target host and waits for a response. It will then display the response in the Command Line window. Usage:

  • ping IpAddress
  • ping ComputerName.DomainName.Local – Does not always need to have .DomainName.Local. If there are issues with pinging via ComputerName, try the Fully Qualified Domain Name.
  • ping ComputerNameOrIpAddress -t – Sends a continuous ping to the device until you cancel it with CTRL+C.
  • ping ComputerNameOrIpAddress -4 – If pings are coming back using IPv6, use the -4 switch to only get IPv4 addresses back.

2. IP Config – Gathers IP information of the device running the command. Common switches are:

  • ipconfig – Displays IP address, subnet mask, and default gateway for each adapter.
  • ipconfig /all – Displays the full TCP/IP configuration for all adapters.
  • ipconfig /flushdns – Clears the DNS resolver cache.
  • ipconfig /registerdns – Initiates manual registration for DNS names.
  • ipconfig /release – Messages the DHCP server to release the IP address configuration. Check with Tier 2 before using this command. You will lose all communication to the computer this is run on.
  • ipconfig /renew – Messages the DHCP to renew IP address configuration.

3. System File Checker – Scans for corruptions in system files and restores corrupted or missing files. Usage:

  • sfc /scannow

4. QWinsta – Displays information about Terminal Sessions. Look for the username of the account that you need to log off and keep in mind the ID of the user. Usage:

  • qwinsta -server ServerNameOrIpAddress

5. RWinsta – Sends commands to the remote session. Use the ID number in order to log off the user that the ID number belongs to. Usage:

  • rwinsta -server ComputerNameOrIpAddress IdNumber

6. NSLookup – Tests and troubleshoots DNS servers. Usage:

  • nslookup – Displays information about the Default DNS server.
  • set type=mx – After you use nslookup, you can specify which records you are looking for. After you set the type, enter the domain name.

7. Telnet – Text oriented communication using a virtual terminal connection. Usage:

  • telnet IpAddressDomainNameOrComputerName PortNumber – telnet smtp.google.com 25. This will test the connection from your computer to smtp.google.com on port 25.

8. System Info – Displays the system’s information in Command Line. Usage:

  • systeminfo | more – You can view system uptime, Operating system, and System Manufacturer.

9. Check Disk – Creates and displays a status report for a disk. Usage:

  • chkdsk (/f /r) – Do not use parenthisis. Chkdsk by itself will display the status report. Using /f will fix errors on the disk. Using /r will locate bad sectors and recover readable data. Both switches will require the computer to be rebooted and will run before boot. This will require approval before using these switches.

10. Shutdown – Initiates a shutdown command. Usage:

  • shutdown.exe /m ComputerNameOrIpAddress /f /r /t 0 /d p:0:0 – Shuts the computer down and forces (/f) the logoff and a reboot (/r) instantly (specified by /t TimeInSeconds) while sending a report to the system (/d p:0:0) saying it is a planned shutdown. You only need to specify /m ComputerNameOrIpAddress if you are attempting to shut down a remote computer.

11. Net Stat – Displays incoming and outgoing connections. Usage:

  • netstat -an – The -a switch displays all active connections and ports on which the computer is listening. The -n switch displays active connections.
  • netstat -an | find “PortNumber” – Finds all connections that are using the specified port.

12. NBT Stat – Helps troubleshoot NetBIOS name resolution problems. Usage:

  • nbtstat -an IpAddress – Useful tool if you know the IP address of a computer but not the name. This will  return the name and MAC address of the device.

13. Change Directory – Changes the directory of the Command Line to wherever you specify. Usage:

  • DriveLetter: – If you need to change the Command Line to a different drive, use this command.    Example:      c:     will change it to the C: drive.
  • cd c:usersUserName – Changes the Command Line to c:usersUserName.

14. Trace Route – Displays the route information and transit delays to a specific address. Usage:

  • tracert DomainNameOrIpAddress – You will see a list of hops that it takes to get to the destination. If anything fails, you will see where in the route it is failing.

15. Task List – Displays all processes the computer is currently running. Usage:

  • tasklist – Displays process name, process ID, session name, session number, and memory usage. You will only need to look at the process name (Image Name) and process ID (PID).

16. Task Kill – Kills whichever task you specify. Usage:

  • taskkill /switch – /PID PID specifies which process ID you want to kill. /IM ImageName specificies which image name you want to kill. Examples:
    taskkill /pid 2000
    taskkill /im chrome.exe

17. W32TM – Diagnose, view, and change Windows Time information.

  • w32tm /config /update – Updates current time configuration if there were any changes made.
  • w32tm /resync – Resynchronizes computer’s time as soon as possible.
  • To change Windows Time Server, on PDC, run w32tm /config /syncfromflags:manual /manualpeerlist:0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org. You will then need to run w32tm /config /update on the PDC and any device that needs time updated, or you can reboot the machines.

18. Remote Desktop Connection – Connects your computer to a remote computer. Usage:

  • mstsc /switch – Mstsc will start remote desktop. If you add any switches, they can help with the look/layout of the connection window. /F (full screen) is the most common switch. /Console can be used if you cannot connect normally.
  • Example: mstsc /f /console

19. Net Start and Net Stop – Starts or stops services by service name. Usage:

  • netstart ServiceName – Starts service.
  • netstop ServiceName – Stops service.
  • && – Runs multiple commands as soon as possible without delay. Example: net stop explorer.exe && net start explorer.exe.

20. VSS Admin – Manages the Volume Shadow Copy Service. Usage:

  • vssadmin list writers – Lists all subscribed volume shadow copy writers on the system. This can be helpful when troubleshooting backups issues.

Instructions on how to get computer name for Windows XP, Vista and Windows 7 KB1039390

KB1039390

Instructions on how to get computer name for Windows XP, Vista and Windows 7:

First open a command prompt by opening a “Run” box and type in cmd.  Then in the command prompt type in hostname.  What reports below that line will be the computers name.  If that doesn’t work use the articles below.

Windows XP
1. Go to Start, Settings, Control Panel.

1

2. Double-click on the System icon.

2

3. Click on the Computer Name tab.

3

4. Highlight the text to the right of Full computer name and copy it by pressing Ctrl-C
(or right-click in the highlighted area and select ‘Copy’).

4

5. Paste the text by pressing Ctrl-V (or right-click anywhere in a text box and select ‘Paste’).

Windows Vista
1. Click on the Windows Vista Start button on the lower left corner of your computer screen:

5

2. Click on the Control Panel menu item:

6

3. Click on the System and Maintenance link:

7

4. Click on the System link:

8

5. You will find the computer name on the System screen:

9

Windows 7
Hit start
Right click on “Computer”

10

Select “Properties” with a left click
You will find the computer name on the System screen where you see the red box

11