NET.exe
The
NET Command is used to manage File Shares, Printer Shares and sessions as follows: Display a local shareNET SHARE sharenameDisplay a list of computers in the current domain. NET VIEWTo see a list of shares on a remote computer NET VIEW \\ComputerNameTo see a list of all shares in the domain:NET VIEW /DOMAINTo see a list of shares on a different domainNET VIEW /DOMAIN:domainnameTo see a list of shares on a remote Netware computer NET VIEW /NETWORK:NW [\\ComputerName]Create a new local file shareNET SHARE sharename=drive:path /REMARK:"text" [/CACHE:Manual Automatic No ]Limit the number of users who can connect to a shareNET SHARE sharename /USERS:number /REMARK:"text"Remove any limit on the number of users who can connect to a shareNET SHARE sharename /UNLIMITED /REMARK:"text"Delete a shareNET SHARE {sharename devicename drive:path} /DELETEDelete all shares that apply to a given deviceNET SHARE devicename /DELETEIn this case the devicename can be a printer (Lpt1) or a pathname (C:\Docs\)Join a file share (Drive MAP)
NET USE Display all the open shared files on a server and the lock-idNET FILEClose a shared file (disconnect other users and remove file locks)NET FILE id /CLOSEList all sessions connected to this machineNET SESSIONList sessions from a given machineNET SESSION \\ComputerNameDisconnect all sessions connected to this machineNET SESSION /DELETEDisconnect all sessions connected to this machine (without any prompts)NET SESSION /DELETE /yDisconnect sessions from a given machineNET SESSION \\ComputerName /DELETENotes:NET SESSION displays incoming connections only, in other words it must be run on the machine that is acting as the server.
To create file shares the SERVER service must be running, which in turn requires 'File and Print Sharing' to be installed.
"Don't worry about people stealing an idea. If it's original, you will have to ram it down their throats" - Howard Aiken
ARP Address Resolution Protocol
ASSOC Change file extension associations
ASSOCIAT One step file association
AT Schedule a command to run at a later time
ATTRIB Change file attributes
BOOTCFG Edit Windows boot settings
BROWSTAT Get domain, browser and PDC info
CACLS Change file permissions
CALL Call one batch program from another
CD Change Directory - move to a specific Folder
CHANGE Change Terminal Server Session properties
CHKDSK Check Disk - check and repair disk problems
CHKNTFS Check the NTFS file system
CHOICE Accept keyboard input to a batch file
CIPHER Encrypt or Decrypt files/folders
CleanMgr Automated cleanup of Temp files, recycle binCLEARMEM Clear memory leaks
CLIP Copy STDIN to the Windows clipboard.CLS Clear the screenCLUSTER Windows Clustering
CMD Start a new CMD shell
COLOR Change colors of the CMD window
COMP Compare the contents of two files or sets of filesCOMPACT Compress files or folders on an NTFS partitionCOMPRESS Compress individual files on an NTFS partition
CON2PRT Connect or disconnect a PrinterCONVERT Convert a FAT drive to NTFS.
COPY Copy one or more files to another location
CSCcmd Client-side caching (Offline Files)
CSVDE Import or Export Active Directory data
DATE Display or set the dateDcomcnfg DCOM Configuration Utility
DEFRAG Defragment hard drive
DEL Delete one or more files
DELPROF Delete NT user profiles
DELTREE Delete a folder and all subfolders
DevCon Device Manager Command Line Utility
DIR Display a list of files and folders
DIRUSE Display disk usage
DISKCOMP Compare the contents of two floppy disks
DISKCOPY Copy the contents of one floppy disk to anotherDNSSTAT DNS Statistics
DOSKEY Edit command line, recall commands, and create macros
DSADD Add user (computer, group..) to active directory
DSQUERY List items in active directory
DSMOD Modify user (computer, group..) in active directory
ECHO Display message on screen
ENDLOCAL End localisation of environment changes in a batch file
ERASE Delete one or more files
EXIT Quit the CMD shell
EXPAND Uncompress files
EXTRACT Uncompress CAB files
FC Compare two files
FDISK Disk Format and partition
FIND Search for a text string in a file
FINDSTR Search for strings in files
FOR /F Loop command: against a set of files
FOR /F Loop command: against the results of another command
FOR Loop command: all options Files, Directory, List
FORFILES Batch process multiple files
FORMAT Format a diskFREEDISK Check free disk space (in bytes)
FSUTIL File and Volume utilities
FTP File Transfer Protocol
FTYPE Display or modify file types used in file extension associations
GLOBAL Display membership of global groups
GOTO Direct a batch program to jump to a labelled line
HELP Online Help
HFNETCHK Network Security Hotfix Checker
IF Conditionally perform a command
IFMEMBER Is the current user in an NT Workgroup
IPCONFIG Configure IP
KILL Remove a program from memory
LABEL Edit a disk label
LOCAL Display membership of local groups
LOGEVENT Write text to the NT event viewer.
LOGOFF Log a user off
LOGTIME Log the date and time in a file
MAPISEND Send email from the command line
MEM Display memory usage
MD Create new folders
MKLINK Create a symbolic link (linkd)
MODE Configure a system device
MORE Display output, one screen at a time
MOUNTVOL Manage a volume mount point
MOVE Move files from one folder to another
MOVEUSER Move a user from one domain to another
MSG Send a message
MSIEXEC Microsoft Windows Installer
MSINFO Windows NT diagnostics
MSTSC Terminal Server Connection (Remote Desktop Protocol)
MUNGE Find and Replace text within file(s)
MV Copy in-use files
NET Manage network resources
NETDOM Domain Manager
NETSH Configure network protocols
NETSVC Command-line Service Controller
NBTSTAT Display networking statistics (NetBIOS over TCP/IP)
NETSTAT Display networking statistics (TCP/IP)
NOW Display the current Date and Time
NSLOOKUP Name server lookup
NTBACKUP Backup folders to tape
NTRIGHTS Edit user account rights
PATH Display or set a search path for executable files
PATHPING Trace route plus network latency and packet loss
PAUSE Suspend processing of a batch file and display a message
PERMS Show permissions for a user
PERFMON Performance Monitor
PING Test a network connection
POPD Restore the previous value of the current directory saved by PUSHD
PORTQRY Display the status of ports and services
PRINT Print a text file
PRNCNFG Display, configure or rename a printer
PRNMNGR Add, delete, list printers set the default printer
PROMPT Change the command prompt
PsExec Execute process remotely
PsFile Show files opened remotely
PsGetSid Display the SID of a computer or a user
PsInfo List information about a system
PsKill Kill processes by name or process ID
PsList List detailed information about processes
PsLoggedOn Who's logged on (locally or via resource sharing)
PsLogList Event log records
PsPasswd Change account password
PsService View and control services
PsShutdown Shutdown or reboot a computer
PsSuspend Suspend processes
PUSHD Save and then change the current directory
QGREP Search file(s) for lines that match a given pattern.
RASDIAL Manage RAS connections
RASPHONE Manage RAS connections
RECOVER Recover a damaged file from a defective disk.
REG Registry: Read, Set, Export, Delete keys and values
REGEDIT Import or export registry settings
REGSVR32 Register or unregister a DLL
REGINI Change Registry Permissions
REM Record comments (remarks) in a batch file
REN Rename a file or files.
REPLACE Replace or update one file with another
RD Delete folder(s)
RDISK Create a Recovery Disk
RMTSHARE Share a folder or a printer
ROBOCOPY Robust File and Folder Copy
ROUTE Manipulate network routing tables
RUNAS Execute a program under a different user account
RUNDLL32 Run a DLL command (add/remove print connections)
SC Service Control
SCHTASKS Create or Edit Scheduled Tasks
SCLIST Display NT Services
ScriptIt Control GUI applications
SET Display, set, or remove environment variables
SETLOCAL Control the visibility of environment variables
SETX Set environment variables permanently
SHARE List or edit a file share or print share
SHIFT Shift the position of replaceable parameters in a batch file
SHORTCUT Create a windows shortcut (.LNK file)
SHOWGRPS List the NT Workgroups a user has joined
SHOWMBRS List the Users who are members of a Workgroup
SHUTDOWN Shutdown the computer
SLEEP Wait for x seconds
SOON Schedule a command to run in the near future
SORT Sort input
START Start a separate window to run a specified program or command
SU Switch User
SUBINACL Edit file and folder Permissions, Ownership and Domain
SUBST Associate a path with a drive letter
SYSTEMINFO List system configuration
TASKLIST List running applications and services
TIME Display or set the system time
TIMEOUT Delay processing of a batch file
TITLE Set the window title for a CMD.EXE session
TOUCH Change file timestamps
TRACERT Trace route to a remote hostTREE Graphical display of folder structure
TYPE Display the contents of a text file USRSTAT List domain usernames and last login
VER Display version information
VERIFY Verify that files have been saved
VOL Display a disk label
WHERE Locate and display files in a directory tree
WHOAMI Output the current UserName and domain
WINDIFF Compare the contents of two files or sets of files
WINMSD Windows system diagnostics
WINMSDP Windows system diagnostics II
WMIC WMI Commands
XCACLS Change file permissions
XCOPY Copy files and folders
ADDUSERS Add or list users to/from a CSV file
The NET Command is used to manage network resources as follows: Manage Services
NET START, STOP, PAUSE, CONTINUEConnect to a file/print Share (Drive Map)
NET USECreate/view file/printer Shares
NET SHARE, VIEW, FILE, SESSIONSManage Network Print jobs and Network Time
NET TIME, PRINTSecurity
NET ACCOUNTS, USER, GROUP, LOCALGROUPNetwork Messaging
NET NAME, SENDHelp
NET HELP, HELPMSGNetwork configurationNET COMPUTER, CONFIG_WORKSTATION, CONFIG_SERVER, STATISTICS_WORKSTATION, STATISTICS_SERVERWhen you use NET commands in a batch file, you can use the Y or N switch to unconditionally answer Yes or No to questions returned by the Net command"The white man knows how to make everything but he does not know how to distribute it" -
Sitting BullThe
NET Command is used to manage services as follows: Syntax NET START [service] NET STOP [service] NET PAUSE [service] NET CONTINUE [service] Key service : The service name as shown in Control Panel, Services
To list the basic NT Services:
NET HELP SERVICES
To list the running NT Services:
NET START
If you try to start a service that is already running you will get this error message:"The requested service has already been started. More help is available by typing NET HELPMSG 2182"You can redirect and FIND this type of error as follows:NET START alerter 2>&1FIND "2182" IF errorlevel 1 goto :s_started
The
NET Command is used to connect to a File/Printer Share as follows:
Join a file share (Drive MAP) - Win 2K / XP / 2003 NET USE [driveletter:] \\ComputerName\ShareName\folder1\folder2 /PERSISTENT:No
The commands below work in NT 4 or greater -Make all future connections persistent (auto-reconnect at login)NET USE /Persistent:Yesor NET USE /P:Yes
Make all future connections non-persistent (reconnect with login script)NET USE /Persistent:NoorNET USE /P:No
Join a file share (Drive MAP)NET USE [driveletter:] \\ComputerName\ShareName /PERSISTENT:YES
Join a file share (Drive MAP) - with a "long" share nameNET USE [driveletter:] "\\ComputerName\ShareName"
Connect a user to their HOME directoryNET USE [devicename *] [password *]] [/HOME]This requires the users Home server/folder to be defined in ADUCJoin a password protected file share (Drive MAP)NET USE [driveletter:] \\ComputerName\ShareName[\volume] [password *][/USER:[domainname\]username] [/PERSISTENT:No]In the above command /USER can also be specified as:[/USER:[dotted domain name\]username][/USER:[username@dotted domain name] In a script, to map a drive and wait until the mapping has completed before continuing:
START /wait NET USE [driveletter:] \\ComputerName\ShareNameThis will be a little slower, but ensures that files can be read from the mapped drive immediately.Join a Printer ShareNET USE [LPTx:] \\ComputerName\printer_share /PERSISTENT:YESJoin a Printer Share - with a "long" share nameNET USE [LPTx:] "\\ComputerName\printer_share"Disconnect from a shareNET USE [driveletter:] /DELETE
Examples
NET USE H: /HomeNET USE H: \\MainServer\Users\%Username%NET USE W: \\MainServer\GroupShare /Persistent:NoNET USE \\MainServer\SharedPrinterNotes:NET USE command can map a network printer to an LPT port (for DOS type applications that print to a port.) but this does not add the printer to Control Panel - Printers.
By default all mapped drives have a 15 minute idle session timeout, you can modify this with the
NET CONFIG command. This timeout does affect NT and 2000 but actually became visible in the XP GUI, this behaviour is to improve the overall performance.
Alternatives
Windows Scripting Host (WSH) provides alternative and arguably better commands, for XP and 2003 this is the way to go:
Wsh.MapNetworkDrive [
example script ]
Wsh.AddWindowsPrinterConnection [
Examples]
Drive Descriptions
Recent versions of Windows display a drive description, this can be edited in the Explorer GUI. The text is stored in the registry.Win 2K stores a description for each drive letter, XP stores a description for each share.Win XP registryHKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\##ComputerName#ShareName_LabelFromReg=
(string REG_SZ) Windows 2000 registryHKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints\DriveLetter\_LabelFromRegCache = (REG_BINARY data type)
"Two roads diverged in a wood, and I-I took the one less traveled by,And that has made all the difference - Robert Frost
The NET Command is used to manage Network Print jobs and Network Time as follows: The NET TIME command requires the `server' service to be running on the machine that is serving the time.Display the time at this computer plus the DATE in US FormatNET TIME \\%ComputerName%Display the date and time from another computerNET TIME \\machinenameDisplay the date and time from the logonserverNET TIME %LOGONSERVER%Display the time from the domain timeserverNET TIME /DOMAINDisplay the time from another domainNET TIME /DOMAIN:domainname
Define the time server for your domainNET TIME /setsntp:ServerName.DomainName.com
List the time server(s) for your domainNET TIME /querysntp
Synchronise the computer's clock with that of the domain. NET TIME /DOMAIN /SET /YSynchronise the computer's clock with a different domain. NET TIME /DOMAIN:domainname /SETSynchronise the computer's clock with that of another computerNET TIME \\servername /SET /YESUnder Windows 2000 - you can also use the "w32tm" commandSynchronise the computer's clock with a time server in a different domain. NET TIME /RTSDOMAIN:domainname /SETDisplay the job# of current print jobsNET PRINT \\ComputerName\ShareNameHold a print job waiting in the printer queueNET PRINT [\\ComputerName] job# /HOLD Release a print job that has been held.NET PRINT [\\ComputerName] job# /RELEASEDelete a print job from a printer queue.NET PRINT [\\ComputerName] job# /DELETE
List all available printers NET VIEW \\MyServer find "Print"
The NET Command is used to manage network security resources as follows:View user account password and logon requirements (also displays the machine type - NT Server or NT workstation)NET ACCOUNTSView password and logon requirements for the network domain.NET ACCOUNTS /DOMAINSet the number of minutes a user has before being forced to log off when the account expires or valid logon hours expireNET ACCOUNTS /FORCELOGOFF:minutes /DOMAINPrevent forced logoff when user accounts expireNET ACCOUNTS /FORCELOGOFF:NO /DOMAINSet the minimum number of characters for a password. NET ACCOUNTS /MINPWLEN:c /DOMAINThe range is 0-14 characters; the default is 6 characters.Set the maximum number of days that a password is valid.NET ACCOUNTS /MAXPWAGE:dd /DOMAINThe range is 1-49710; the default is 90 days.Set passwords to never expire.NET ACCOUNTS /MAXPWAGE:UNLIMITED /DOMAINSet a minimum number of days that must pass before a user can change a password (default = 0)NET ACCOUNTS /MINPWAGE:dd /DOMAINRequire that new passwords be different from 'x' number of previous passwordsNET ACCOUNTS /UNIQUEPW:x /DOMAINThe range for 'x' is 1-24Synchoronise the user accounts database (PDC and BDC)NET ACCOUNTS /SYNC /DOMAINView user account detailsNET USER [/DOMAIN]Add a user account.NET USER username {password *} /ADD [options] [/DOMAIN]Modify a user account. NET USER [username [password *] [options]] [/DOMAIN]Delete a usernameNET USER username [/DELETE] [/DOMAIN]Add a WorkgroupNET GROUP groupname /ADD [/COMMENT:"text"] [/DOMAIN]Edit a workgroupNET GROUP [groupname [/COMMENT:"text"]] [/DOMAIN]Delete a groupNET GROUP groupname /DELETE [/DOMAIN]Add a user to a groupNET GROUP groupname username [...] /ADD [/DOMAIN]Delete a user from a groupNET GROUP groupname username [...] /DELETE [/DOMAIN]To View, Add or modify a local workgroup replace GROUP in the commands above with LOCALGROUP.
Example
Create a group
C:\>NET LOCALGROUP spud /addThe command completed successfully.
Add to guests
C:\>NET LOCALGROUP guests spud /addThe command completed successfully.
Then remove
C:\>NET LOCALGROUP guests spud /deleteThe command completed successfully.
C:\>NET LOCALGROUP spud /deleteThe command completed successfully.
The NET Command is used to send network messages as follows:Network broadcast messages use "messaging names". A messaging name can be the ComputerName, your UserName or any other name you add as part of the NET NAME command line. To add an additional messaging name for receiving messages. NET NAME extraname /ADDTo remove a messaging nameNET NAME extraname /DELETEIt is not possible to remove the ComputerName with this commandTo send a broadcast message to another userNET SEND j_smith Meeting changed to 3 p.mTo send a broadcast message to another machineNET SEND mc_144 Meeting changed to 3 p.mTo send a message to all users who have a session with the serverNET SEND /USERS This server will shut down in 5 minutes. To send a broadcast message to the whole domainNET SEND * This server will shut down in 5 minutes.To send a broadcast message to another domainNET SEND /DOMAIN[:other domainname] This server will shut down in 5 minutes.To use NET SEND the Messenger service must be running
The NET Command is used to display help as follows: The syntax for displaying help differs from other NT commands:Provide brief help with any NET command
NET option suboption /?e.g. NET CONFIG SERVER /?
Provide detailed help with any NET command
NET option suboption /HELP orNET HELP option suboptione.g. NET CONFIG SERVER /HELPNET HELP CONFIG SERVER
To provide help with a Windows error message (Typically the 4 digit number from the Event Viewer system log)
NET HELPMSG message#e.g.NET HELPMSG 2184
Explanation of how to read NET HELP screens.
NET HELP SYNTAX
To display NET Help one screen at a time:
NET HELP option MORE
The NET Command is used to manage network resources as follows: Managing Network configurationTo add a computer to the domainNET COMPUTER \\ComputerName /ADDThis command is only available from the Server and is best run from the Primary Domain Controller (PDC)To remove a computer from the domainNET COMPUTER \\ComputerName /DELThis command is only available from the Server and is best run from the Primary Domain Controller (PDC)Change the idle session timeout (default = 15 minutes)NET CONFIG SERVER /Autodisconnect:mmTo disable idle timeouts altogetherNET CONFIG SERVER /Autodisconnect:-1Note this may reduce overall performance - see related KBase articles below.To remove a machine from Network NeighbourhoodNET CONFIG SERVER /hidden:yesBefore using the /hidden option see Q128167
Change the comment displayed in My Computer (detail view)NET CONFIG SERVER /Srvcomment:"YourText"Display or change the Workstation Service communication device settingsNET CONFIG WORKSTATION /?Display statistics for the local Workstation serviceNET STATISTICS WORKSTATIONDisplay statistics for the local Server serviceNET STATISTICS SERVER
Mode is an all purpose configuration command, used without parameters, MODE displays the status of all devices installed on your system. Devices Show the status of all devices: (Typically COM1, COM2, LPT1, CON)MODE Show the status of a specific device:MODE [device] To additionally show the status of any redirected parallel printer:MODE [device] [/STATUS] CMD Prompt window size Change the CMD prompt screen size/buffer Number of cols(characters) wide and Number of lines deepMODE CON[:] [COLS=c] [LINES=n]KeyboardSet the keyboard typematic rate, the rate at which a character is repeated when you hold down the key. MODE CON[:] [RATE=r DELAY=d] Printing To redirect output from a parallel port (PRN, LPT1, LPT2, or LPT3) to a serial port(COM1, COM2, COM3, etc). You must be a member of the Administrators group to redirect printing. To configure a parallel printer port (PRN, LPT1, LPT2, or LPT3): MODE LPTn[:]=COMm[:]To setup the parameters for a serial port (* see Start, Help, Commands for more on this). MODE COMm [options*]Configure a printer connected to a parallel printer port. mode LPTn[:] [c][,[l][,r]] mode LPTn[:] [cols=c] [lines=l]This allows you to configure a line printer connected to a parallel printer port. International SettingsChange the current code page: MODE CON[:] CP SELECT=yyyDisplay the current Code page: MODE CON[:] CP [/STATUS]
Examples:
MODE CON:cols=80 lines=25
"The dogma of the ghost in the machine" - Gilbert Ryle
SUMMARY
loadTOCNode(1, 'summary');
This article describes how to use the net user command to change the user password at a Windows command prompt. Only administrators can change domain passwords at the Windows command prompt.
MORE INFORMATION
loadTOCNode(1, 'moreinformation');
To change a user's password at the command prompt, log on as an administrator and type:
net user user_name * /domain
When you are prompted to type a password for the user, type the new password, not the existing password. After you type the new password, the system prompts you to retype the password to confirm. The password is now changed. Alternatively, you can type the following command:
net user user_name new_password
When you do so, the password changes without prompting you again. This command also enables you to change passwords in a batch file. Non-administrators receive a "System error 5 has occurred. Access is denied" error message when they attempt to change the password.
ram
ram disk device
Ram is a block device to access the ram disk in raw mode.It is typically created by: mknod -m 660 /dev/ram b 1 1 chown root:disk /dev/ram
FILES /dev/ram
"All your life you live so close to truth it becomes a permanent blur in the corner of your eye. And when something nudges it into outline, it's like being ambushed by a grotesque." Tom Stoppard, Rosencrantz and Guildenstern are Dead