RMTSHARE - CMD


Overview

RMTSHARE is a command-line utility in Windows that allows users to manage shared resources on a network. The command can create, delete, view, or modify network shares on either a local or remote computer. This tool is particularly useful in networking environments for managing shared access to directories and printers.

Syntax

The basic syntax to use RMTSHARE includes several variations depending on the operation:

  • To list all shares:
    RMTSHARE \\servername
    
  • To view a specific share:
    RMTSHARE \\servername\sharename
    
  • To create a share:
    RMTSHARE \\servername\sharename=path [options]
    
  • To delete a share:
    RMTSHARE \\servername\sharename /DELETE
    

Parameters:

  • \\servername: Specifies the server on which the operation is performed.
  • sharename: The name of the share.
  • path: The local path being shared.

Options/Flags

  • /DELETE: Deletes the specified share.
  • /USERS:number: Limits the number of users who can simultaneously access the shared resource.
  • /REMARK:"text": Adds a descriptive comment to the share.
  • /GRANT:user,perm: Grants permissions to a user. perm can be READ, CHANGE, or FULL.
  • /REMOVE:user: Removes user permissions from a share.

Examples

  1. Listing all shares on a local server:
    RMTSHARE \\localhost
    
  2. Creating a share:
    RMTSHARE \\localhost\Docs=C:\Documents /REMARK:"Shared Documents" /GRANT:Everyone,READ
    
  3. Modifying share permissions:
    RMTSHARE \\localhost\Docs /GRANT:John,FULL /REMOVE:Guest
    
  4. Deleting a share:
    RMTSHARE \\localhost\Docs /DELETE
    

Common Issues

  • Permission Errors: Users might face access denied errors if they do not have sufficient privileges. Ensure administrative rights before modifying shares.
  • Syntax Errors: Incorrect syntax can lead to command failure. Double-check the command syntax.
  • Network Issues: Ensure the target server is accessible and online when managing remote shares.

Integration

RMTSHARE can be combined with other commands for scripting and automation:

@echo off
REM Batch script to setup a new shared folder
RMTSHARE \\localhost\NewShare=C:\NewFolder /GRANT:Admin,FULL
echo Successfully created share
  • NET SHARE: Similar command in Windows CMD to manage network shares.
  • NET USE: Command to connect/disconnect from shared network resources.

For further details, Microsoft’s official documentation and support websites are valuable resources for learning more about network commands and troubleshooting common issues.