Networking / Beginners

The Net File command

This command lists all open shared files and the number of file locks placed on each file. You can also use this command to close files and remove locks, which is a useful procedure when a user manages to accidentally leave a file open or locked. Here's the syntax:

C:\>net file [id [/close]]

The following paragraphs describe the Net File command's parameters:

  • ID: The file's identification number.
  • Close: Closes an open file and releases any locks that were placed on the file.

To close a file, you must issue the command from the server where the file is shared.

Net Files works, too.

To close an open file, first run Net File without any parameters to list the open files. Here's a sample of the output that you can expect from Net File:

File 	Path 		Username 	#locks
----------------------------------------------
0 	C:\BUDGET.DOC 	WARD 		0
1 	C:\RECIPE.MDF 	JUNE 		4

Next, run Net File again, specifying the file number displayed for the file that you want to close. For example, to close the RECIPE.MDF file, use this command:

C:\>net file 1 /close

The Net Group command

This command lets you add, display, or change global groups. This command has a number of different syntaxes, depending on how you intend to use it.

To display information about a group or to change a group's comment, use this syntax:

net group groupname [/comment:"text"] [/domain]

To create a new group, use this syntax:

net group groupname /add [/comment:"text"] [/domain]

To delete a group, use this syntax:

net group groupname /delete [/domain]

Finally, to add or remove users from a group, use this syntax:

net group groupname username[ ...] {/add | /delete} [/domain]

The following paragraphs describe the parameters that you can use with the Net Group command:

  • Groupname: The name of the group to add, change, or delete. If you specify this parameter and no others, a list of users in the group appears.
  • Comment: Specifies a comment for the group. The comment can be up to 48 characters in length and should be enclosed in quotation marks.
  • Domain: Specifies that the operation should be performed on the primary domain controller rather than on the local computer.
  • Add: Creates a new group or adds users to an existing group. Before you add a user to a group, you must first create a user account for the user.
  • Delete: Removes a group or removes users from the group.
  • Username: One or more usernames to be added to or removed from the group. If you list more than one name, separate the names with spaces.

Windows isn't picky: You can specify Net Groups rather than Net Group if you want.

This example lists all the groups on a server:

C:\>net group

This example adds a group named Admin:

C:\>net group Admin /add

This example adds three users to the Admin group:

C:\>net group Admin Ward Wally June /add

This example lists the users in the Admin group:

C:\>net group Admin

The Net Help command

This command displays help for the Net command or for a specific Net subcommand. Here's the basic syntax:

net help [command]

The command parameter can be any of the following commands:

ACCOUNTS 	HELP 		SHARE
COMPUTER 	HELPMSG 	START
CONFIG 		LOCALGROUP 	STATISTICS
CONFIG 		SERVER 		NAME STOP
CONFIG 		WORKSTATION 	PAUSE TIME
CONTINUE 	PRINT 		USE
FILE 		SEND 		USER
GROUP 		SESSION 	VIEW

You can type net help services to display a list of services that you can start via the Net Start command.

The Net Helpmsg command

This command displays an explanation of network error codes. Here's the syntax:

net helpmsg message#

The message# parameter should be the four-digit number displayed when the error occurred. For example, if you get an error with message 2180, use this command to see an explanation of the error:

C:\>net helpmsg 2180
The service database is locked.
EXPLANATION
Another program is holding the service database lock.
ACTION
Wait for the lock to be released and try again later. If
    it is possible to determine which program is holding the
    lock, then end that program.
[Previous] [Contents] [Next]