In Windows, one can share files to other users in the same network using SMB protocol. We can disable sharing of a folder/drive from command prompt using net share command.
Open elevated windows command prompt and run the below command.
C:\>net share Share name Resource Remark ------------------------------------------------------------------------------- C$ C:\ Default share IPC$ Remote IPC ADMIN$ C:\WINDOWS Remote Admin The command completed successfully.
To disable sharing C$, run the below command
C:\>net share C$ /DELETE C$ was deleted successfully.
An alternative option is to disable file sharing on the computer. This disables sharing for all folders.
net stop lanmanserver
Example:
C:\>net stop lanmanserver The following services are dependent on the Server service. Stopping the Server service will also stop these services. Computer Browser Do you want to continue this operation? (Y/N) [N]: y The Computer Browser service is stopping... The Computer Browser service was stopped successfully. The Server service is stopping. The Server service was stopped successfully.
Now if you list the network shares, you would get message that the server is not running.
C:\>net share The Server service is not started. Is it OK to start it? (Y/N) [Y]: n C:\>
Adding users from command line is much easier than going through the UI. It saves…
Do you want to delete a directory from Windows command prompt(CMD)? This post explains how…
We can kill a process from GUI using Task manager. If you want to do…
Chrome is definitely the stable browser compared to other ones and it has been my…
Windows has multiple command line utilities that can help find the version of the Windows…
There are multiple ways to check whether a Windows computer is running 32-bit OS or…
View Comments
Thanks! I sometimes have to connect to LAN outside home/office network and the command helps shutoff all share folders