remove a share 



rmshare [-fhirv] [-S hostname] [-n sharename | -p path]... [sharename]


The rmshare utility removes a share. The share can be specified either with the path name of the directory being shared (with the -p option> or with the share name (with the -n option). Additionally, if an argument follows the option list, it is treated as a share name to be removed and processed as if it had been specified as an argument to the -n.

If a remote machine is not specified with the -S option or as part of the share name, rmshare assumes that the specified share resides on the local machine.



removes hidden shares without first asking for confirmation. When you specify this option and a share does not exist, rmshare does not display and does not modify the exit status.

The -f option overrides the -i option.


includes hidden shares among those to be removed. Normally hidden shares are not removed.


prompts you before removing a specified share.

-n sharename 

specifies the name of the share to be removed. If sharename is a UNC name of the form //hostname/name, the effect is the same as specifying -S hostname -n name.

-p path 

specifies the path name of the shared directory whose share is to be removed.


(recursive) removes shares associated with subdirectories of the specified share. For example, if both c:/dir and c:/dir/subdir are shared, rmshare -p c:/dir normally only removes the share associated with c:/dir. However, rmshare -r -p c:/dir removes the shares associated with both directories.

-S hostname 

Specifies the remote machine on which the share to be removed resides.


When running this utility on a 8.1/2012R2/10/2016/2019/11/2022 system and using the -S to specify a remote Windows 95/98/Me system, some operations may fail, due to limitations in the operating systems.


(verbose) displays additional information about the share being removed.


Possible exit status values are:


Successful completion.


An error occurred.


A usage error occurred.


Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


lsshare, mkshare

PTC MKS Toolkit 10.4 Documentation Build 39.