Cmd commands to connect a new user. Commands for checking and correcting network settings
Many users do not know that Windows has such a tool as the command line. It is used quite rarely and mainly by people who need advanced functionality of the system. the command line has in its arsenal a huge number of operators and features that are not visualized.
We will not consider all the commands, but we will pay attention only to useful operators for working with the local network and the Internet.
Get network adapter configuration with ipconfig
The first command we will look at is ipconfig. The result will be an exhaustive network connection information computer. It shows the main characteristics of all network adapters of a computer or laptop.
What parameters can be obtained using this operator:
- To know addressWi-fi, by which you can enter the device settings. It is shown as the main gateway.
- Can define yourIP if the device is connected to a local network. By the way, a computer connected to a router is also considered to be located in local network.
- If you are connected via L2TP, PPPoE or PPTP, you can defineInternet IP, which is set in the connection properties. But it would be better to use any site to obtain such information, since the address may not always be displayed correctly.
Flush DNS cache - ipconfig /flushdns
In case of errors ERR_ NAME_ RESOLUTION_ FAILED or ERR_ DNS_ FAIL while working with the Internet, as well as if DNS addresses were changed manually or automatically, you can use ipconfig /flushdns. The operator will flush the DNS cache, as Windows does not always do this itself, and old names may be used after server changes.
ping and tracer commands
If you start having problems with the network, such as unstable operation, Internet outages or problems with sites, then you need to try one of the commands - ping or tracert.
The first pings the required resource or device, i.e. check if your computer sees it. For example, the google.com search engine does not open. It is enough to enter ping google.com and see the result.
The screenshot shows that the site is defined and the packet transfer rate is shown. The result is how many packets were sent and how many came back. If the resource is not available, then in response we receive a message that timeout exceeded. Accordingly, the result will be packet loss, which will be indicated on the command line.
Tracing performed by the tracert command allows you to completely trace the path of the package. If the site is slow, you can find out exactly where the delay occurs.
Checking network connections netstat –an
The netstat command is a powerful tool that allows you to find out many network parameters. One of the most useful functions is the definition of all used in this moment ports, connections, remote IPs. To use it, just write in the console netstat -an.
Using telnet
The telnet client must be connected before it can be used. For this you need open control panel and go to " programs and components". It allows you to connect and work with servers without using third-party software.
Other useful network commands
Not all commands are included in the article, we chose the most, in our opinion, useful ordinary user. However, there are a few more operators worth mentioning:
![](https://i1.wp.com/composs.ru/wp-content/uploads/2018/03/setevye_komandy_Windows6.jpg)
That's all. We have considered only a small part of the possibilities of the command line. Many of the commands that are described in the article have additional options and features. But we did not go into details, but considered only those that can be useful at home. The entire set of functions will be useful only to narrowly focused specialists.
In operating rooms Windows system 7.8 or 10 the command line is of course not as strong a tool as the system console in Linux. But nevertheless, she knows a lot and with correct use this is also a very good help in the work of both a professional and a beginner. To start it, just click the "Start" button and type the phrase "Command Prompt". In the results there will be a shortcut to launch the console. But you can do it faster - just press the key combination Win + R, in the "Open" line enter the command cmd and click on "OK".
After that you will see a black window with a blinking cursor. It is where directives must be entered. I will give a list of basic Windows command line commands.
List of Windows cmd line commands:
append is a command that allows you to open data files from the specified folder as if they were in the current folder.
arp- work with the ARP protocol table (Address Resolution Protocol)
assoc- work with associations: view or change file extension associations for applications
at- Windows Task Scheduler
attrib- change the attribute of the desired file
bcdboot is a system utility used to create a system partition or restore a boot environment on a system partition that is created by copying a small set of boot environment files from an installed image. In other words, the command starts copying the boot files to the system partition and creating a new boot configuration (bcd)
bcdedit- editing configuration Windows boot(bcd)
bootcfg- changing the boot parameters of the operating system in the boot.ini file
bootsect- work with boot sectors to ensure that the ntldr or bootmgr bootloaders work
cacls- editing file access control lists (in other words, creating an ACL - Access Control List)
call- call from a batch file of subroutines or other batch files
cd- change the current directory (short for Change Directory)
change— change the terminal server settings. Contexts - logon, port, user. Similar commands:
Chglogon-chgport-chgusr
chcp- view or change the current code page
chkdsk- a disk check utility (short for Check Disk)
chkntfs- checking the NTFS file system for errors and managing the disk check when the OS boots
choice- this command allows you to add an element of interactivity to the batch file by implementing user input in the batch file.
cipher- work with file encryption
clip- redirecting the output of the command line to the Windows clipboard
cls- clearing the contents of the console screen in the command line
cmd or command- launching another copy of the MS-DOS command line
color- access to change the background and text color in the console window
comp- comparison of the contents of the specified files
compact- work with compression and decompression of files in NTFS partitions
convert— converting the disk file system from one file system to another. For example, from FAT to NTFS.
copy- command line command to copy files and directories
date- display or change the current date on the computer
debug- start the Windows debugger
defrag- launch system application for disk defragmentation
del- deleting the selected file or several files at once
devcon- device management through the command console
diantz- creating .cab archives. An analogue of the makecab command.
dir- display a list of files and directories
diskpart- system utility for managing disk partitions
dokey- Editing and recalling Windows commands, using macros.
driverquery- display information about the drivers installed in the system.
echo- displaying text on the console screen
edit- console text editor
endlocal- end of local changes environment variables in batch file
erase- deleting the specified files (analogous to the del command)
esentutl- Extensible Storage Engine database maintenance application for Windows
event create- writing a message to the Windows event log
exit— exit from a running utility, procedure, or batch file
expand- unpacking compressed files with the CAB extension.
extract- content extraction, unpacking CAB files in Windows (EXTRAC32)
fc- compare content in selected files
find- search for a string with a given character in a file
findstr- search for strings in files using regular expressions
for- a "for" loop for processing the results of executing other commands, lists, and lines in text files
forfiles- executing a specific command for each file in a given group
format- disk formatting
fsutil- management utility file system disk
ftp- built-in console FTP client
ftype- view and change file extensions and associated applications
getmac- a Windows console command that shows the physical addresses (so-called MAC addresses) of network adapters available on the computer (including WiFi)
goto- a command for organizing an unconditional jump in a batch file. Usually used with an "if" or "for" command.
help- Windows command line help
hostname- display the name of the computer on the network
icacls- access list management (acl)
if- operator conditional execution of commands in a batch file
ipconfig- view information about the parameters of network adapters and manage the configuration of the IP protocol
label- editing disk volume labels
logman- work with the operating system performance monitor
log off- end the current user session
makecab- creating compressed .CAB files
meme- output help about memory usage in the console
md- creating a new directory (folder)
mklink- work with symbolic links to files and folders
mode- configuring system devices in the CMD environment
more- pagination of information or file contents
mountvol- manage volume mount points
move- moving files and directories
movefile- moving or deleting busy files on next reboot
msg— sending messages to active users in the system
nbtstat- display of statistics and cache of names of the NETBIOS over TCP / IP protocol (NetBT)
net- work with local network resources
netcfg- display and change the configuration of network components
netsh- command network shell Network Shell, which has advanced capabilities for working with network services
netstat- output statistics of active network connections
nslookup- view DNS data in the command line for the selected site or IP address
open files- management of files opened locally or via the network
path- change the search path for executable files
pathping- simultaneous route tracing and ping of each of the intermediate nodes with the ability to assess the quality of each of the route sections
pause- pause when executing a batch file in the console
ping- a test system utility for checking the availability of a host on a local network or the Internet
popd- return to the directory that was previously marked with the pushd command
pnputil- a utility for working with Plug-n-Play (PnP) device drivers
power cfg- configuring system power settings
print- printing a text file from the command line
prompt- change the prompt line in the console
pushd- save the current directory path
qprocess- showing the current state of processes
query- information about the current state of processes and user sessions (analogue of the qprocess and quser commands)
quser— reflection of information about user sessions
rasdial And rasphone- session management remote access
rd- deleting the specified directory (short for Remove Directory)
reagentc- administration of the Windows recovery environment
recover- recovery of files on a damaged disk
reg- command line utility for working with the Windows registry
regedit- import and export of Windows registry data
regsvr32- register or unregister DLL
regini- access control to registry keys
rem- comment in the batch file line
rename(ren) - rename files
replace- replacing or adding files in directories
reset- reset remote desktop session (RDP session)
rmdir- deleting a directory
robocopy- system utility Reserve copy and directory synchronization
route- work with the Windows routing table
runas- launch the specified application on behalf of another user (usually Administrator)
rundll32- registration DLL files and launch them as an application
sc- Windows Service Control (short for Service Control)
schtasks- work with the task scheduler
sclist- list of operating system system services
set- setting and changing Windows environment variables
setlocal- setting local variables in a batch file
setx- utility for creating system variables
sfc- verification and recovery system files Windows
share- control access to files and folders from the local network
shift- shift input parameters for a batch file
- shutdown or restart the computer from the command line
sleep- time delay in batch file
sort- sort lines in the selected file
start- launching an application or a batch file through the console
subst- assigning a drive letter to a directory or canceling an already set assignment
systeminfo— display of complete information about the system
takeown- change the owner of a file or folder
taskkill— termination of active processes in local system or on a remote computer
tasklist- display a list of running tasks, applications and Windows services
time- display and setting the current time
telnet- built-in Windows telnet client
tftp- built-in console TFTP client
timeout- delay in batch files
title- changing the title of the window of the running command interpreter CMD.EXE
tracert- tracing a route to a host on a local network or the Internet
tree- displaying the directory structure in the form of a "tree"
type- output to the console the contents of the specified text file
typeperf- display performance information
tzutil- work with time zones
ver- display the version of the operating system
verify- setting the mode for checking recorded files
vol- output the label data of the selected volume
vssadmin- Administration of the Volume Shadow Copy Service
wait for- forced waiting for a signal or action by the command
where- display the location of the files
whoami- display the name of the current user
windiff- comparison of the contents of the selected files
winrm- remote control system from console
winrs- remote command line Remote Shell
winsat- system performance checker
wmic- execute WMI command
xcopy- copying files and folders
Note: All these commands can be used not only in the CMD.EXE interpreter, but can also be used as executable BAT files.
Examples of using CMD command line commands:
Working with the registry:
reg add - Add a parameter to the registry
reg compare - Compare parts of the registry.
reg copy - Copies from one section to another
reg delete - Deletes the specified parameter or section
reg export - Export part of the registry
reg import - Respectively import part of the registry
reg load - Loads the selected part of the registry
reg query - Displays the values of a given registry branch
reg restore - Restores the selected part of the registry from a file
reg save - Saves the selected part of the registry
reg unload - Unloads the selected part of the registry
System:
shutdown /r 0 - immediate system reboot
shutdown / h 0 - immediate shutdown of the computer
systemInfo - will show a lot of useful information about the computer
Group and user management:
net localgroup group user /add- Add to the group "group", the user "user"
net localgroup group user /delete- Remove the user "User" from the group "group"
net send comp "Hi!"- send a message "Hello" to the computer user "comp"
net sessions- list of user sessions
net session /delete close all open network sessions
net use Z: \\computer name\folder\- connect as network drive with the letter "Z:\" folder on the specified remote computer
net user user /active:no- block the user "user"
net user user /active:yes- unlock the user "user"
net user user /domain- information about the user "user" of the domain "domain"
net user user /add- add user "user"
net user user /delete- delete user "user"
Net:
netstat -a- list of all network connections to the machine
nbtstat -A 192.168.1.2- the username of the user working on the remote machine with the IP address 192.168.1.2.
Calling system utilities, snap-ins and Windows management consoles:
Through commands on the command line, you can run any utilities and system programs of the operating system. Windows systems, including system snap-ins for managing disks, devices, group policies and so on. Simply enter the name of the desired object and press the Enter key.
appwiz.cpl - Add/Remove Programs
certmgr.msc - Certificate management console
ciadv.msc - Indexing Service
cliconfg - Configuring SQL Network Client
clipbrd - Windows Clipboard
compmgmt.msc - System Snap-in "Computer Management"
dcomcnfg - DCOM component management console
ddeshare - DDE shares (doesn't work on Win7)
desk.cpl - Managing screen properties
devmgmt.msc - Start Windows Device Manager
dfrg.msc - Disk Defragmenter
diskmgmt.msc - Disk Management Console
dxdiag - Diagnostic Tool
eudcedit - Personal character editor
eventvwr.msc - View system event log
firewall.cpl - settings of the built-in firewall (firewall) Windows
gpedit.msc - Windows Group Policy Editor
iexpress - IExpress2.0 Self-Extracting Archive Wizard
fsmgmt.msc - Working with shared folders
fsquirt - Bluetooth File Transfer
chkdsk - Console system program to check disks
control admintools - system snap-in "Computer Administration"
control netconnections - folder " Network connections»
control printers - Section "Printers and Faxes" of the control panel
control schedule - Windows Scheduler(Scheduled task)
control userpasswords2 - Account Management
compmgmt.msc - "Computer Management" system console
lusrmgr.msc - Local Groups and Users Wizard
mmc - create your own rig
msconfig - System Configuration Program. Management of startup, service startup, etc.
mstsc - Remote Desktop Connection
ncpa.cpl - Open the Network Connections folder (similar to control netconnections)
ntmsmgr.msc - Working with removable storage devices
odbccp32.cpl - Data Source Administrator
perfmon.msc - System Performance
regedit - Windows registry editor
rsop.msc - Snap resulting RSoP policies
secpol.msc - Local Group Policy Editor
services.msc - Manage Windows Services
sfc /scannow - System File Checker and Repair
sigverif — File signature verification
sndvol - Volume mixer. Sound volume control
sysdm.cpl - System properties
sysedit - Editor of system files Boot.ini, Config.sys, Win.ini, etc.
syskey - Account Database Security
taskmgr - Start Windows Task Manager
utilman - Utility Manager
verifier - Checking the digital signature of drivers
wmimgmt.msc - WMI Management Instrumentation Service
Don't worry if you've never used the command line before. It's pretty simple. We will tell you everything you need to get started using it. Below you will find some of the most important commands for setting up your home network.
1. PING
PING is one of the basic and most useful CMD commands. It displays the quality of the connection, shows whether your computer can send data to the target IP address, and if so, at what speed.
Here is an example using the command:
The command operates according to the following principle: it sends out a certain number of data packets and determines how many of them returned back. If some of them did not return, she reports the loss. Packet loss leads to poor performance in games and webcasts. This is a great way to test your internet connection.
By default, the command sends four packets with a timeout of four seconds for each. You can increase the number of packets like this: ping www.google.com -n 10
You can also increase the timeout duration (displayed in milliseconds): ping www.google.com -w 6000
2.TRACERT
TRACERT stands for Trace Route. Like PING, the command sends a packet of data to solve network problems. However, it does not determine the speed of sending and returning the packet, but its route.
Usage example:
The command displays a list of all routers through which data passes on the way to the end node. Why do we see three duration metrics for each router? Because TRACERT sends three data packets in case one of the routers gets lost or takes too long for some reason.
3. PATHPING
The PATHPING command is similar to TRACERT, but it is more informative and therefore takes more time to execute. It analyzes the route of data packets and determines at which intermediate nodes the loss occurred.
Usage example:
4. IPCONFIG
This command is most commonly used for network debugging in Windows. And it's not just the amount of information it provides, but also the fact that it is combined with several keys to execute certain commands.
Usage example:
When entered without keys, IPCONFIG reflects all the network adapters on your computer, as well as how they work. IPv4 Addresses and Default Gateway contain the most important information.
To flush the DNS cache, use the following switch: ipconfig /flushdns
This operation can help if the Internet is working, but you cannot get to some sites or servers.
5. GETMAC
Each IEEE 802 compliant device has a unique MAC (Media Access Control) address. The manufacturer assigns each piece of equipment its own address, which is registered in the device itself.
Usage example:
You may see multiple MAC addresses, depending on how many network adapters are installed on your computer. For example, Wi-Fi and Ethernet internet connections will have separate MAC addresses.
6.NSLOOKUP
NSLOOKUP stands for Name Server Lookup. The potential of this utility is huge, but most people don't need it. For ordinary users, only the ability to determine the IP address of a domain name is important.
Usage example:
Keep in mind that some domains are not tied to the same IP address, which means that you will receive a different address each time you enter the command. This is quite normal for large sites because they are loaded from a huge number of computers.
If you want to convert an IP address to a domain name, just type it into your browser and you'll see where it leads. However, not all IP addresses lead to domain names. Many of them cannot be reached through a web browser.
7.NETSTAT
This utility is a tool for collecting statistics, analysis and diagnostics. It is quite complicated if you use all its potential (for example, to set up a local area network of an enterprise).
Usage example:
By default, the command shows all active connections on your system. An active connection does not mean that data is being exchanged. It only indicates that a port is open somewhere, and the device is ready to connect.
The command also has several keys that change the type of information displayed. For example, the key -r will display the routing tables.
8.NETSH
NETSH stands for Network Shell. This command allows you to configure almost any network adapter on your computer in more detail.
When you type NETSH, the command line enters shell mode. Inside it there are several contexts (routing, DHCP-related commands, diagnostics).
You can see all contexts like this:
And you can see all the commands within the same context like this:
You can dig deeper and see a list of all subcommands within a single command:
For example, you can type the following command to see all network drivers and their characteristics on your system: netsh wlan show drivers
Keep in mind that if you really want to get serious about configuring your network through the command line, you will have to master this command.
CMD is called differently - the command line interpreter (the exact translation of the abbreviation "command line interpreter"), the Windows command handler, the command processor. True, not all Windows users know what tasks can be solved with its help. As a rule, these are Linux users, system administrators and users who still remember operating system DOS. Today we want to tell you how to launch and use CMD.
Launching the cmd.exe executable file (\Windows\System32 folder) that allows you to execute commands entered from the keyboard is possible in several ways.
Making settings
After launching cmd, you can start configuring it with context menu, which is opened by right-clicking on the window title. Then select the Default option and make the settings.
We configure the ability to use the mouse to select text:
- go to the General tab;
- turn on the checkbox Selection by mouse;
- press the Ok button.
Now we can select a piece of text with the left mouse button and press the Enter key to copy it to the clipboard.
Use the Colors, Font and Position tabs to make the rest of the settings.
Note that all settings set using the Default option are saved for all subsequent cmd sessions. If you want to run a configuration task for the current session only, use the Properties option of the context menu.
Let's start working
We begin our acquaintance with the Windows command handler with a list of commands, which we obtain using the help directive. We type it in the command line and make it run by pressing the Enter key:
help
The list consists of two columns - the name of the command and its description.
You can get detailed help in two ways:
help commandname
or
command_name /?
Example: get help for chkdsk :
help chkdsk
or
chkdsk /?
To avoid redialing, we use the command buffer, which is scrolled through combinations Shift keys+ or Shift+↓ .
We use the right mouse button to paste the contents of the clipboard into the cmd handler screen.
The cls command is for clearing the screen:
cls
To exit cmd, use the exit directive:
exit
As you can see, everything is simple. Now let's figure out why cmd commands are needed, how to use them and what tasks they allow you to solve.
Working with files and folders
Although Windows Explorer specifically designed to work with files and folders, many users prefer it file managers such as, for example, Total Commander. Without a doubt, working with any of these programs is much more convenient than using the command line. However, it may happen that none of these applications can be launched, and in such emergency situations, cmd comes to the rescue with directives dir, cd, mkdir, rmdir, del, copy, type.
DIR
dir is used to view the contents of a folder (directory).
To view the contents of the current directory, simply type:
If you want to see in the current folder only executable files with the .exe extension, you'll have to work a little harder and type in a longer string:
Let's complicate the task and see the list of exe files of a folder that is not the current one, for example d:\work :
dir d:\work\*.exe
CD
cd is used to change the current folder.
We are in the d:\work\example\ folder and we want to go one level up to the work folder:
And now let's go to the folder d:\music\songs\ :
cd d:\music\songs\
And we will finish our voyage by going to the root folder of the current disk:
MKDIR and RMDIR
mkdir creates folders (directories), and can create a whole tree test->test1->test2 at once:
mkdir \test\test1\test2
And rmdir with the /S key will easily remove this tree:
DEL, COPY, TYPE
del and copy are for deleting and copying files, respectively.
Delete all files with the .tmp extension from the current folder:
We copy all files with the .mp3 extension from the music folder of the disk d: to a USB flash drive with the logical name f:
copy d:\music\*.mp3 f:
Our acquaintance with the commands of this group is completed by the type directive intended for displaying the contents of a text file on the screen:
type D:\"Krylov's Fables"\"Fox and Grapes.txt"
Note that file and folder names with spaces must be enclosed in quotation marks.
We work with the network
Network commands are a tool used mainly by system administrators and some advanced users to solve various network problems.
- ipconfig is used for tasks such as displaying TCP/IP protocol settings and configuring DHCP options.
We get all the settings for network adapters:
ipconfig /all - nslookup is used to determine an ip address from a hostname and vice versa:
nslookup odnoklassniki.ru
tells us the ip-address of the Odnoklassniki social network - 217.20.147.94,
nslookup 87.240.131.97
"says" that the ip-address 87.240.131.97 belongs to another social network - VKontakte. - ping allows you to perform the task of verifying connectivity with a host by sending/receiving icmp control packets. No response from the host does not always mean no connection. Sometimes hosts don't ping because sysadmins don't allow echo-reply icmp "response" packets to be sent.
- The tracert command, Linux users know it as traceroute , allows you to get a "route" - a chain of nodes that an ip-packet passes from the initial "our" node to the final one.
Let's try to get "trace" on Google:
tracert google.com
NET is the most popular network utility
net is one of the most used commands because it allows you to perform many tasks on network resources:
- connecting/disconnecting network drives;
- start/stop system services;
- add/remove users;
- management of shared "shared" resources;
- setting the system time;
- display information about resource usage.
We will demonstrate one of the features of the net.exe program - working with system services using the example of a print spooler.
To access services, we are used to using the windows interface, but knowing the name of the service, and the print manager is called Spooler, it is very easy to stop it
net stop spooler
and restart.
net start spooler
You can get a list of network services using this sentence:
net help services
But if you want to work with the print manager, source uninterruptible power supply, a remote access connection manager through windows services, they can also be launched from cmd using a snap file:
- start task manager:
taskmgr.exe - launching the registry editor:
regedit.exe - launch device manager:
devmgmt.msc
Some programs that have a command line interface are superior to standard ones. windows programs. For example, the devcon.exe program, called command-line device manager, not only provides the ability to enable/disable/uninstall devices and update drivers, but also provides driver developers with information about devices that cannot be obtained using windows device manager.
Recently, I had to solve an interesting problem, namely, to find out all the ip addresses of equipment on the local network. It seems like an ordinary problem, but it could be solved different ways. I would like to consider some of them in this article.
How to display a list of ip addresses on the network?
The first way to find out all ip addresses on the local network is to work through the command line.
To do this, we press the start button, in search query we write "cmd" and press the "Enter" key.
A command line editor window will open in front of us. There are a lot of commands in the editor that can be useful to us, but in this case we need the “arp -a” command.
Enter this command in the terminal as shown in the following figure:
The “arp” command gives us not only the opportunity to determine the ip of the equipment, but also shows this equipment, which may also be of interest to us.
So, after you have entered the command and pressed "Enter", you will see the entire list of ip addresses of equipment on the local network.
If you are only interested in the ip address of only your computer, then you need to enter the “Ipconfig” command in the terminal - then you will see all the data on your computer.
However, such commands do not always determine all Ip in the local network. And in this case, you will need a program to search for ip addresses on the network "Advanced IP Scanner" - this is a network scanner. You can download it on the Internet, and I, in turn, will tell you how to work with it.
Network scanning for ip addresses
After installing the program, we click on the “Advanced IP Scanner” icon.
As a result of the launch, we see how the working window of the program opens.
As you can see, the scan showed us not only the IP of the equipment, but also the name of the manufacturer and mac addresses - that is, complete information about the network.
But we do not always have access to computers on the local network: in this case, we have to use a smartphone, in my case it is an android-based smartphone. Download the network scanner program (for example, I have Network IP scanner). And after starting, we press the network scan button: as a rule, after a few minutes we see the result of a network scan for ip addresses.