Change the default drive
To change the default drive, simply type the drive letter of your choice and press enter
Examples:
C:\ > D: [Enter] (Changes the default drive from C to D)
D:\ > C: [Enter] (Change the default drive from D to C)
Change Directory
To change directory use CD command
C:\ > CD furniture (Moves to the directory called FURNITURE)
C:\furniture > CD \ (Move to main folder c:\)
C:\furniture\audain > CD.. (Move back to the root folder C:\)
C:\furniture\audain > CD .. (Move back to the previous Folder C:\furniture)
Copying one or more files to another location
C:\ > copy c:\kermit.exe e: (Copies the file ‘ kermit. EXE ‘ from drive C on drive E and gives it the same name)
C:\ > copy e:\trip1.dat f:\south\trip2.dat (Create a copy of “trip1.dat” from E Drive, Put it in the drive F, in the “South” subdirectory and rename it to “trip2.dat”.
Copy files and directory trees.
XCOPY SOURCE DESTINATION/
C:\ > XCOPY c:\*.* d:\ /e/y (copy all files and subdirectories from drive C to drive D)
/E (Copies directories and subdirectories, including those that are empty)
/Y (deletes the request to confirm that you want to overwrite an existing destination file)
Displays a list of files and subdirectories in a directory or disk.
C:\ > dir (Display the list of files and subdirectories of drive C)
C:\ > dir d: (Display the list of files and subdirectories of drive d)
C:\ > dir e:\ *.exe (Displays all files on drive E with an “EXE” extension)
C:\ > dir e:\kermit.* (Displays all files on drive E whose filename is “KERMIT”)
C:\ > dir e:\labe?.com (Displays all files of five letter including the first four letters “Labe” and “com” as an extension.
C:\ > dir e:\format.c?? (Lists all files with a filename “format” and have a three – letter extension starting with “C”)
Rename files and directories
C:\ > ren file1 file2 (Rename the file1 to file2)
c:\ > ren *.txt *.bak (Rename all text files to files bak extension.
C:\ > rename e:\audain beaudain (Rename the directory audain to beaudain)
Note that you cannot specify a new drive or path for your destination file or directory
Deletes one or more files
C:\ > del file1 (Delete file1)
C:\ > del file1 file2 (Delete file1 and file2)
C:\ > del *.exe (Delete all files with exe extension)
C:\ > del /f *.exe (/F force deletion of read-only files)
Creates one or more directories
C:\ > mkdir trip (Creates a Directory named trip)
C:\ > mkdir trip1 trip2 (Creates two directories named trip1and trip2)
C:\ > mkdir Africa\trip5 (Creates a directory named Africa and a subdirectory named trip5)
Delete a directory
C:\ > Rd trip (It is only possible to run this command if the directory you want to delete is empty)
C:\ > Rd /S Africa (/S deletes all directories and files in the specified directory including the Directory itself. Used to delete a directory tree if not empty.
Format a disk for use with Windows.
C:\ > format e: (The E drive formats)
C:\ > format e: /FS:fat32 /Q (Format E drive)
/FS: filesystem Specifies the file system type (FAT, FAT32, NTFS )
/Q is fast formatting .
Displays the network configuration
C:\ > ipconfig (To display only the IP address, subnet mask, and default gateway for each TCP /IP)
C:\ > ipconfig /all (To view detailed information. Ethernet adapter local area connection)
C:\ > ipconfig /release (To release the IP address)
C:\ > ipconfig /renew (To renew the IP address)
Ping (To check your connectivity)
C:\ > ping 192.168.1.1
Tracert (Show detail about the path pakets take on a network)
c:\ > tracert google.com
NETSTAT
Displays log statistics and current TCP / IP network connections. This command is only available if the TCP / IP protocol has been installed.
netstat [-a] [-e] [-n] [-s] [-p log] [-r] [interval]
Parameters
-a
Displays all connections and listening connections. Server connections are usually not displayed.
-e
Displays the Ethernet statistics. Can be combined with the -s option.
-n
Displays addresses and port numbers in numeric form (no attempt is made to retrieve names).
-s
Displays statistics by log. By default, statistics for TCP, UDP, ICMP, and IP are displayed. Use the -p option to specify a subset of the default display.
-p protocol
Displays the connections for the protocol specified by protocol. Possible values for protocol are tcp or udp. If this option is used with the -s option for log-based statistics display, tcp, udp, icmp, or ip can be specified for the log.
-r
Displays the contents of the routing table.
Interval
Displays the selected statistics again after the number of seconds specified by Interval. Press CTRL + C to exit the interval display. Without specifying this option, netstat outputs the current configuration information only once.
—
C:\ > netstat -na
NET USE
C:\ > NET use (show information about your mapped drive)
C:\ > net use z: \\computer (Map Z drive to \computer share folder)
C:\ > net use z: \\192.168.1.40\audain (Map Z drive to \audain share folder)
C:\ > net use /delete F: (Remove the F Mapped drive)
NSLOOKUP
C:\ > nslookup www.Google.ca