Microsoft DOS net command
About net
Availability
Net syntax
Net examples
About net
The net command is used to update, fix, or view the network or network settings. Listed in the Syntax are each of net commands.
Availability
The net command is an external command that is available in the below Microsoft operating systems as net.exe.
Windows 95
Windows 98
Windows NT
Windows ME
Windows 2000
Windows XP
Windows Vista
Windows 7
Windows 8
Windows 10
Net syntax
Windows Vista syntax
Windows XP syntax
Windows 2000 syntax
Windows Vista and later syntax
NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP | HELPMSG | LOCALGROUP | PAUSE | SESSION | SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW ]
NET ACCOUNTS | Adjust account settings. [/FORCELOGOFF:{minutes | NO}] [/MINPWLEN:length] |
NET COMPUTER | Add other networked computers with Windows Domain Controller. \\computername {/ADD | /DEL} |
NET CONFIG | Displays your current server or workgroup settings. [SERVER | WORKSTATION] |
NET CONTINUE | Continues the use of service. [service] |
NET FILE | Display opened shared files on the server. [id [/CLOSE]] |
NET GROUP | Add, delete, view, and otherwise manage network workgroups. [groupname [/COMMENT:"text"]] [/DOMAIN] |
NET LOCALGROUP | Add, delete, view, and otherwise manage network groups. [groupname [/COMMENT:"text"]] [/DOMAIN] |
NET NAME | Create or delete name used for messaging. [name [/ADD | /DELETE]] |
NET PAUSE | Pause the specified network service. [service] |
NET SESSION | Display all sessions connected to the computer and deletes them if specified. [\\computername] [/DELETE] |
NET SHARE | Create and manage a local network share. sharename |
NET START | Start the specified network service. [service] |
NET STATISTICS | Display network statistics of the workstation or server. [WORKSTATION | SERVER] |
NET STOP | Stop the specified network service. service |
NET TIME | Display the time and date of another network computer. [\\computername | /DOMAIN[:domainname] | /RTSDOMAIN[:domainname]] [/SET] |
NET USE | Connects or disconnects your computer from a shared resource or displays information about your connections. [devicename | *] [\\computername\sharename[\volume] [password | *]] |
NET USER | Displays users on the computer or domain. [username [password | *] [options]] [/DOMAIN] |
NET VIEW | Displays a list of computers in a specified workgroup or the shared resources available on a specified computer. [\\computername [/CACHE] | /DOMAIN[:domainname]] |
Windows XP syntax
NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP | HELPMSG | LOCALGROUP | NAME | PAUSE | PRINT | SEND | SESSION | SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW ]
NET ACCOUNTS | Adjust account settings. [/FORCELOGOFF:{minutes | NO}] [/MINPWLEN:length] |
NET COMPUTER | Add other networked computers with Windows Domain Controller. \\computername {/ADD | /DEL} |
NET CONFIG | Displays your current server or workgroup settings. [SERVER | WORKSTATION] |
NET CONTINUE | Continues the use of service. [service] |
NET FILE | Display opened shared files on the server. [id [/CLOSE]] |
NET GROUP | Add, delete, view, and otherwise manage network workgroups. [groupname [/COMMENT:"text"]] [/DOMAIN] |
NET LOCALGROUP | Add, delete, view, and otherwise manage network groups. [groupname [/COMMENT:"text"]] [/DOMAIN] |
NET NAME | Create or delete name used for messaging. [name [/ADD | /DELETE]] |
NET PAUSE | Pause the specified network service. [service] |
NET PRINT | Manage network print jobs. \\computername\sharename |
NET SEND | Sends messages to other users, computers, or messaging names on the network. The Messenger service must be running to receive messages. You can send a message only to an name that is active on the network. If the message is sent to a username, that user must be logged on and running the Messenger service to receive the message. {name | * | /DOMAIN[:name] | /USERS} message |
NET SESSION | Display all sessions connected to the computer and deletes them if specified. [\\computername] [/DELETE] |
NET SHARE | Create and manage a local network share. sharename |
NET START | Start the specified network service. [service] |
NET STATISTICS | Display network statistics of the workstation or server. [WORKSTATION | SERVER] |
NET STOP | Stop the specified network service. service |
NET TIME | Display the time and date of another network computer. [\\computername | /DOMAIN[:domainname] | /RTSDOMAIN[:domainname]] [/SET] |
NET USE | Connects or disconnects your computer from a shared resource or displays information about your connections. [devicename | *] [\\computername\sharename[\volume] [password | *]] |
NET USER | Displays users on the computer or domain. [username [password | *] [options]] [/DOMAIN] |
NET VIEW | Displays a list of computers in a specified workgroup or the shared resources available on a specified computer. [\\computername [/CACHE] | /DOMAIN[:domainname]] |
Windows 2000 syntax
NET [ CONFIG | DIAG | HELP | INIT | LOGOFF | LOGON | PASSWORD | PRINT | SEND | SHARE | START | STOP | TIME | USE | VER | VIEW ]
NET CONFIG | Displays your current workgroup settings. NET CONFIG [/YES]
| ||||||||||||||||||||||||||
NET DIAG | Runs the Microsoft Network Diagnostics program to test the hardware connection between two computers and to display information about a single computer. NET DIAGNOSTICS [/NAMES | /STATUS]
| ||||||||||||||||||||||||||
NET HELP | Displays information about NET commands and error messages. command /?
| ||||||||||||||||||||||||||
NET INIT | Loads protocol and network-adapter drivers without binding them to Protocol Manager. This command may be required if you are using a third-party network-adapter driver. You can then bind the drivers to Protocol Manager by typing NET START NETBIND. NET INITIALIZE [/DYNAMIC]
| ||||||||||||||||||||||||||
NET LOGOFF | Breaks the connection between your computer and the shared resources to which it is connected. NET LOGOFF [/YES]
| ||||||||||||||||||||||||||
NET LOGON | Identifies you as a member of a workgroup. NET LOGON [user [password | ?]] [/DOMAIN:name] [/YES] [/SAVEPW:NO]
If you would rather be prompted to type your username and password instead of specifying them in the NET LOGON command line, type NET LOGON without options. | ||||||||||||||||||||||||||
NET PASSWORD | Changes your logon password. NET PASSWORD [oldpassword [newpassword]]
The first syntax line above is for changing the password for your password-list file. The second syntax line above is for changing your password on a Windows NT or LAN Manager server or domain. | ||||||||||||||||||||||||||
NET PRINT | Displays information about print queues and controls print jobs. NET PRINT \\computer[\printer] | port [/YES]
When you specify the name of a computer by using the NET PRINT command, you receive information about the print queues on each of the shared printers that are connected to the computer. | ||||||||||||||||||||||||||
NET SEND | NET SEND {name | * | /DOMAIN[:name] | /USERS} message Sends messages to other users, computers, or messaging names on the network. The Messenger service must be running to receive messages. You can send a message only to an name that is active on the network. If the message is sent to a username, that user must be logged on and running the Messenger service to receive the message.
| ||||||||||||||||||||||||||
NET SHARE | NET SHARE sharename
| ||||||||||||||||||||||||||
NET START | Starts services. NOTE: Services cannot be started from a command prompt within Windows. NET START [BASIC | NWREDIR | WORKSTATION | NETBIND | NETBEUI | NWLINK] [/LIST] [/YES] [/VERBOSE]
To start the workgroup redirector you selected during Setup, type NET START without options. In general, you don't need to use any of the options. | ||||||||||||||||||||||||||
NET STOP | Stops services. NOTE: Services cannot be stopped from a command prompt within Windows. NET STOP [BASIC | NWREDIR | WORKSTATION | NETBEUI | NWLINK] [/YES]
To stop the workgroup redirector, type NET STOP without options. This breaks all your connections to shared resources and removes the NET commands from your computer's memory. | ||||||||||||||||||||||||||
NET TIME | Displays the time on or synchronizes your computer's clock with the shared clock on a Microsoft Windows for Workgroups, Windows NT, Windows 95, or NetWare time server. NET TIME [\\computer | /WORKGROUP:wgname] [/SET] [/YES]
| ||||||||||||||||||||||||||
NET USE | Connects or disconnects your computer from a shared resource or displays information about your connections. NET USE [drive: | *] [\\computer\directory [password | ?]] NET USE drive: | \\computer\directory /DELETE [/YES] NET USE drive: | * /HOME
To list all of your connections, type NET USE without options. | ||||||||||||||||||||||||||
NET VER | Displays the type and version number of the workgroup redirector you are using. NET VER | ||||||||||||||||||||||||||
NET VIEW | Displays a list of computers in a specified workgroup or the shared resources available on a specified computer. NET VIEW [\\computer] [/YES]
To display a list of computers in your workgroup that share |
Net examples
net use z: \\computer\folder
Map the Z: drive to the network path //computer/folder.
net send mrhope "There is hope!"
Send a text message to the computer with a host name of mrhope the message There is hope!. Note: This command only works for Windows versions that support this command.
Tip: Today's computers disable the messenger service, if this service is disabled you cannot send or receive net send messages. If you need this service enabled follow the instructions on this page and choose to enable the service instead of disabling it.
Note: New versions of Windows no longer support the net send command.
net send * "There is hope!"
The above command would send There is hope! to all users in your current domain. This command should be used with caution since if you're on a school or work network many of the computers on that network if not all well be sent a message if the messenger service is enabled on the computers.
net config workstation
Display additional information about the network such as the computers name, workgroup, logon domain, DNS, and other useful information.
net view \\hope
View the available computers and their shared resources you may use either of the below commands. The first example displays available computers. The last command would display the shared resources on the hope computer.
net localgroup
Display all groups currently setup on the computer you're running the command on.
net share
Display all network shares on your computer.
net share hope=c:\hope\files
Create a share called "hope" for the "c:\hope\files" directory. .
Sample of Net View command
In a GUI world, it's easy to forget that you can still perform some very powerful commands from your server's command prompt. In this Daily Drill Down, Brien Posey shows you one of the most powerful commands—the Net command.
If you’ve read many of my Daily Drill Downs, you’ve probably noticed that I tend to use the command prompt excessively. Although I’ve often been ridiculed for using the command prompt in a graphical environment, commands do have their place. one of the biggest uses for commands is in batch files. You can use batch files to automate certain network-related tasks.
Of course, doing so would be very difficult, if not impossible, if you were limited to the basic DOS command set. Fortunately, Windows NT Server and Windows 2000 Server provide an extended set of commands you can use to automate network-related tasks. one such command is the Net command. In this Daily Drill Down, I’ll discuss the Net command. I’ll also show you what the Net command can be used for and explain the syntax behind its various uses.
What is the Net command?
Before you can understand what the Net command is, you must understand a little bit about the way that networks used to work. In the days of DOS and Windows 3.1 (not Windows for Workgroups), Windows had very little built-in network support. The majority of the network functions had to be performed at the DOS level. A typical process was to load the network redirector through the Autoexec.bat file. once the redirector was loaded, the user could interact with the network. This is where the Net command came into play. The Net command was basically a single command that could be used to accomplish a wide variety of network-related tasks, such as logging in or mapping a network drive.
Over the years, the Net command has become obsolete for anything other than automation purposes. Almost every task that can be performed through the Net command can also be accomplished through the Graphical User Interface (GUI). In spite of this fact, the Net command has evolved over the years. Extra functionality has been added to the command, and the Net command is still supported to this day.
Now that you know the history of the Net command and some of its uses, let’s examine the command in detail. In the sections that follow, I’ll discuss each of the Net command’s functions. The Net command is always a two-part command. The Net commands you can issue include the following:
- Net Accounts
- Net Computer
- Net Config
- Net Continue
- Net File
- Net Group
- Net Help
- Net Helpmsg
- Net Localgroup
- Net Name
- Net Pause
- Net Print
- Net Send
- Net Session
- Net Share
- Net Start
- Net Statistics
- Net Stop
- Net Time
- Net Use
- Net User
- Net View
Net Accounts
The Net Accounts command provides a method for displaying the account policies for the domain. You can see a sample of the Net Accounts command here.
Z:\USERS\Administrator>net accounts
Force user logoff how long after time expires?: Never
Minimum password age (days): 0
Maximum password age (days): Unlimited
Minimum password length: 0
Length of password history maintained: None
Lockout threshold: Never
Lockout duration (minutes): 30
Lockout observation window (minutes): 30
Computer role: BACKUP
Primary domain controller for workstation domain: \\SCOOBY
The command completed successfully.
Net Computer
The Net Computer command allows you to add a computer account to or remove a computer account from a domain. What’s cool about this command is that if you have a list of computer account names, you could write a simple batch file to add or remove those account names. You can see a sample of the Net Computer command’s functionality here.
Z:\USERS\Administrator>net computer
The syntax of this command is:
NET COMPUTER \\computername {/ADD | /DEL}
Z:\USERS\Administrator>net computer \\homer /add
The request will be processed at the primary domain controller for domain BUD.
The command completed successfully.
Net Config
Many times when I’ve been working on someone else’s computer, I’ve needed to know the basic settings, such as the computer name, the workgroup name, and the name of the user who’s logged in. The Net Config command provides a quick and easy way to acquire this information. In a Windows 98 or Windows Me environment, the Net Config command displays the type of information shown below:
C:\WINDOWS>net config
Computer name \\TAZ
User name ADMINISTRATOR
Workgroup BUD
Workstation root directory C:\WINDOWS
Software version 4.90.3000
Redirector version 4.00
The command was completed successfully.
The Net Config command also works in Windows NT. The main difference is that you have to specify whether you want to display a summary of a server or a workstation. For example, you’d enter Net Config Workstation. You’d then see a summary similar to the one given in Windows Me but with slightly more detail.
Net Continue
You use the Net Continue command to restart a service that has been paused by a Net Pause command. The syntax for the command is
C:\Windows>net continue service
where service is the name of the service you paused.
Net File
Need to find out who’s using files on your server? Just use the Net File command. As you can see here, the Net File command provides you with a quick summary of which users are attached and how many files they have locked.
Z:\USERS\Administrator>net file
ID Path User name # Locks
———————————————————————————————————-
3 H:\USERS\Administrator Administrator 0
6 H:\USERS\Administrator Administrator 0
16 \PIPE\samr 0
The command completed successfully.
Net Group
The Net Group command allows you to display all of the groups that exist within a domain. You can see a sample of this command here.
Z:\USERS\Administrator>net group
Group Accounts for \\TITANIUM
————————————————————————————————-
*Domain Admins *Domain Guests *Domain Users
*Finance *MTS Trusted Impersonators*test group
*ZZZZ
The command completed successfully.
Net Help
The Net Help command gives you detailed information on a Net command. To use it, just type net help command, where command is the name of the command you want help with.
Net Helpmsg
If Windows 2000 has a problem, it often coughs up confusing error messages and numbers. You can use the Net Helpmsg command to try to find out what the error messages mean. Just type Net Helpmsg errornumber, where errornumber is the error that Windows 2000 has given you.
Net Localgroup
Just as the Net Group command displays all of the domain’s groups, the Net Localgroup command displays a list of the groups that are specific to the local computer. Here’s a sample of the Net Localgroup command.
Z:\USERS\Administrator>net localgroup
Aliases for \\TITANIUM
—————————————————————————————————-
*Account Operators *Administrators *Backup Operators
*Guests *MTS Impersonators *Print Operators
*Replicator *Server Operators *Users
The command completed successfully.
Net Name
You can use the Net Name command to control the name of the server when it sends and receives messages online. If you use the command by itself, you can see the current names configured for your computer. You can add or delete names by using the /ADD and /DELETE switches, respectively.
Net Pause
The Net Pause command pauses services running on your server. It can be useful if you need to pause a service to troubleshoot or make changes to it. To use it, just type Net Pauseservice, where service is the name of the service you want to pause.
Net Print
I can’t count the number of times I’ve needed to add printing capabilities to a batch file. In older versions of Windows, network printing from a batch file usually meant using the Net Use command to capture a printer port and then printing to the captured port. Unfortunately, this technique can cause confusion for end users the next time they try to print because they may have already been using the printer port that the batch file reassigned. If your users are working in a Windows 98, Me, or NT environment, the Net Print command is a good alternative to traditional batch-file printing. The Net Print command allows you to send print jobs to a network printer without capturing an LPT port. You can see the syntax for the Net Print command here.
Z:\USERS\Administrator>net print
The syntax of this command is:
NET PRINT \\computername\sharename
[\\computername] job# [/HOLD | /RELEASE | /DELETE]
Net Send
The Net Send command can be used to send a pop-up message to network users. Just enter the username and the message. As you can see in this sample, the command also offers the capability to send messages to users in another domain.
Z:\USERS\Administrator>net send
The syntax of this command is:
NET SEND {name | * | /DOMAIN[:name] | /USERS} message
Z:\USERS\Administrator>net send Administrator This is a test
The message was successfully sent to ADMINISTRATOR.
Net Session
The Net command can even be used to see which computers are attached to your computer. Simply enter the Net Session command, and you’ll see a summary, similar to this one.
Z:\USERS\Administrator>net session
Computer User name Client Type Opens Idle time
——————————————————————————————————
\\TAZMANIA Windows 2000 21951 01D 10H 46M
\\TITANIUM Windows NT 1381 0 11D 00H 42M
\\TITANIUM Administrator Windows NT 1381 2 00:00:00
The command completed successfully.
Net Share
If you’d like to see which shares exist on a PC, you can do so by using the Net Share command. You can see a sample of this command here.
Share name Resource Remark
——————————————————————————————————
C$ C:\ Default share
ADMIN$ C:\WINNT Remote Admin
REPL$ C:\WINNT\System32\Repl\Export
IPC$ Remote IPC
H$ H:\ Default share
F$ F:\ Default share
print$ C:\WINNT\System32\spool\DRIVERS Printer Drivers
dfs F:\dfs
home_server F:\home_server
Microsoft UAM Volume
F:\Microsoft UAM Volume
NETLOGON C:\WINNT\System32\Repl\Import\S Logon server share
titanium F:\titanium
USERS H:\USERS
4SIMX LPT1: Spooled Marketing
4SIMX2 LPT1: Spooled Management
4SIMX3 LPT1: Spooled Finance
The command completed successfully.
Net Start
This command starts any of the various services that are running. You can also use the Net Pause or Net Continue command to pause or resume services.
Net Statistics
Perhaps one of the most useful Net commands is Net Statistics. The Net Statistics command provides some hard-core statistics on how a server or workstation is communicating across the network. This command merely requires you to follow the Net Statistics command with the word Server or Workstation, as shown here.
Z:\USERS\Administrator>net statistics workstation
Workstation Statistics for \\TITANIUM
Statistics since 12/1/00 6:27 AM
Bytes received 4885909
Server Message Blocks (SMBs) received 51520
Bytes transmitted 6101020
Server Message Blocks (SMBs) transmitted 51523
Read operations 23
Write operations 1199
Raw reads denied 0
Raw writes denied 0
Network errors 0
Connections made 2433
Reconnections made 1
Server disconnects 6
Sessions started 2824
Hung sessions 0
Failed sessions 0
Failed operations 3
Use count 3212
Failed use count 285
The command completed successfully.
Net Stop
This command is the opposite of Net Start. As you can probably guess, this command stops services from running on your server.
Net Time
One of the commands that I’ve personally found very useful is the Net Time command. The Net Time command is used to synchronize the time on a workstation with the time on a server. Here’s the syntax for the Net Time command:
NET TIME [\\computer | /WORKGROUP:wgname] [/SET] [/YES]
- computer—Specifies the name of the computer (time server) whose time you want to check or synchronize your computer's clock with.
- /WORKGROUP—Specifies that you want to use the clock on a computer (time server) in another workgroup.
- wgname—Specifies the name of the workgroup containing a computer whose clock you want to check or synchronize your computer's clock with. If there are multiple time servers in that workgroup, NET TIME uses the first one it finds.
- /SET—Synchronizes your computer's clock with the clock on the computer or workgroup you specify.
- /YES—Carries out the NET TIME command without first prompting you to provide information or confirm actions.
Net Use
Without a doubt, the most powerful Net command in any version of Windows is the Net Use command. The Net Use command is used to attach to resources such as network shares or printers. For example, to map the Q: drive to a share called Articles on a server called Tazmania, you could enter the following command:
Net Use Q: \\Tazmania\Articles
Likewise, you could map LPT1 to a network printer that’s attached to a server called Scooby and shared as HP by entering the following command:
Net Use LPT1: \\Scooby\HP
The Net Use command also provides mechanisms for removing connections that you’ve made and for entering passwords. Here’s a full summary of the Net Use syntax.
C:\WINDOWS>net use /?
Connects or disconnects your computer from a shared
resource or displays information about your connections.
NET USE [drive: | *] [\\computer\directory [password | ?]]
[/SAVEPW:NO] [/YES] [/NO]
NET USE [port:] [\\computer\printer [password | ?]]
[/SAVEPW:NO] [/YES] [/NO]
NET USE drive: | \\computer\directory /DELETE [/YES]
NET USE port: | \\computer\printer /DELETE [/YES]
NET USE * /DELETE [/YES]
NET USE drive: | * /HOME
drive Specifies the drive letter you assign to a
shared directory.
* Specifies the next available drive letter.
If used with /DELETE, specifies to
disconnect all of your connections.
port Specifies the parallel (LPT) port name you
assign to a shared printer.
computer Specifies the name of the computer sharing
the resource.
directory Specifies the name of the shared directory.
printer Specifies the name of the shared printer.
password Specifies the password for the shared
resource, if any.
? Specifies that you want to be prompted for the
password of the shared resource. You don't
need to use this option unless the password is
optional.
/SAVEPW:NO Specifies that the password you type
should not be saved in your password-list
file. You need to retype the password the
next time you connect to this resource.
/YES Carries out the NET USE command without
first prompting you to provide information or
confirm actions.
/DELETE Breaks the specified connection to a shared
resource.
/NO Carries out the NET USE command, responding
with NO automatically when you are prompted
to confirm actions.
/HOME Makes a connection to your HOME directory if
one is specified in your LAN Manager or
Windows NT user account.
To list all of your connections, type NET USE without options. To see this information one screen at a time, type the following at the command prompt:
NET USE /? | MORE
or
NET HELP USE | MORE
Net User
Another use for the Net command is viewing all of the user accounts that exist on a given machine. To do so, simply enter the Net User command, as shown here.
Z:\USERS\Administrator>net user
User accounts for \\TITANIUM
———————————————————————————————-
Admin Administrator Billy_Brown
Brien Brien_Posey Guest
IUSR_SCOOBY IUSR_TALAINIA IUSR_TITANIUM
IWAM_SCOOBY IWAM_TALAINIA IWAM_TITANIUM
Jeremy_Broyles Kendall_Hensley Migrate
Normal Rep Shamir
Shamir_Dasgupta Talainia_Posey Taz
Test
The command completed successfully.
Net View
This command displays the other computers that are visible on the network. You can see a sample of Net View’s output here.
Z:\USERS\Administrator>net view
Server Name Remark
—————————————————————
\\SCOOBY
\\TALAINIA
\\TAZ BRIEN
\\TAZMANIA
\\TITANIUM
The command completed successfully.
Conclusion
In this Daily Drill Down, I explained how you can use the Net command to automate many common network tasks. As I did, I outlined the syntax used for each type of task.
The authors and editors have taken care in preparation of the content contained herein but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.
'컴퓨터관련' 카테고리의 다른 글
dosbox mount 명령어...펌 (0) | 2016.04.22 |
---|---|
guest 계정 활성화 및 비번 null...펌 (0) | 2016.04.18 |
hyper-V 윈7설치...펌 (0) | 2016.04.17 |
hyper-V vs virtualbox...펌 (0) | 2016.04.17 |
Hyper-V 윈도우 가상머신 시작할때부터 난 오류...펌 (0) | 2016.04.17 |