While file or folder sharing is a very convenient and quick way to share your files within your home network, it could be really risky if open to the public. Just for your information, when you allow file sharing to any network, a Users folder is created on your PC through which others can access your My Documents folder and the desktop and this makes your PC vulnerable to the attacks. Thus it is recommended to restrict folder sharing in Windows 11/10. Let’s learn how to do that.
How to check your Shared folders in Windows 11/10
Before we proceed with how to stop folder sharing, let’s first learn how to check if any of your folders are shared publicly or not.
- Using fsmgmt.msc
- Using Command Line
1] Via fsmgmt.msc
Press Win+R to open Run Dialogue.
Type the following and hit Enter:
This will open a window showing all the shared folders on your PC.
2] Via Command Line
Press Win+R and type CMD to open Command-Line.
Type the following and hit Enter:
The command-Line will then display all the shared folders on your PC.
Restrict Folder Sharing in Windows 11/10
Now let us see how to restrict or stop Folder Sharing in Windows 11/10:
- Through Explorer
- By Removing access
- Via Command Prompt
- Via Control Panel
- Using PowerShell
- Using Computer Management.
1] Through File Explorer
- Press Win+E to open your Files Explorer.
- Go to the folder you don’t want to be open for the public.
- Right-click and open Properties.
- Go to Sharing and click on Advanced Sharing.
- Uncheck the box saying, Share this folder
- Click OK and Apply.
2] By Removing Access
- Press Win+E to open File Explorer.
- Go to the shared folder.
- Right-click and go to Give Access and click on Remove Access.
That’s it, you are done.
3] Via Command Prompt
You can also stop folder sharing via Command Prompt.
To open Command Prompt, Type Command Prompt in the search bar in your taskbar.
Select Command Prompt, right-click, and select Run as Administrator.
Type net share to see all your shared folders.
This will display all the shared folders on your PC.
Locate the folder you want to restrict sharing.
Now type the following and hit Enter and you are done.
net share (shared folder) /delete
For example, here I’ve created a Sharetest folder in my Drive E to test and now deleting it via the Command Prompt.
Yes, the Command Prompt says Share test was deleted successfully but that just means that it’s not shared anymore. The folder is still available on your PC.
Read: How to share Files and Folders over a Network in Windows 11/10
4] Via Control Panel
- Press Win+R and type Control Panel to open it.
- Go to Network and Sharing Center.
- Click on Change Advanced Sharing Settings.
- Go to All Networks.
- Under Public Folder Sharing, select the option saying ‘Turn off public folder sharing’
- Click on Save Changes.
Once turned off, all your folders shared with the public will be disabled. People logged on to this PC will still be able to see and access these folders.
5] Stop sharing folders using PowerShell
If you want to stop sharing folders using Windows PowerShell in Windows 11/10, you can follow the below instructions:
- The first thing you need to do is launch the elevated PowerShell prompt. You can do this by pressing the Windows key + R simultaneously in order to initiate a Run command.
- Now type PowerShell in the text box and press the Ctrl+Shift+Enter keyboard shortcut. Click on the Yes button if UAC appears on your computer screen.
- Type the following command in the Windows PowerShell window and press Enter. A list of shared folders on Windows 11 will appear as a result.
- Next, type the following command and press the Enter key. This will stop sharing a specific folder::
Remove-SmbShare -Name "(shared folder)"
- In the command, change (shared folder) for the name of the shared folder you want to stop. As an example, here I have created a “D$” folder in my Drive D: to test and I am now deleting it using PowerShell.
- For confirmation, type A and click Enter. Performing the above action will stop the folder from being shared on the network.
6] Stop sharing folders with Computer Management on Windows 11/10
It is possible to stop sharing a folder within its location, but using Computer Management is the best option. This is because it allows you to see and control all shares from one place.
Here are the steps you can use to stop file sharing with Computer Management:
- Press the Windows key + S to open the Windows search bar.
- Type Computer Management into the search box and click the top result.
- From the left side of the screen, expand the Shared Folders section.
- Click on the Shares item. You should now right-click on the folder in the right panel of the screen.
- After that, select Stop Sharing to remove the folder from the network.
- Click the Yes button when a popup appears on the screen.
- The share was created only for administrative purposes and will reappear once the computer or Server service is restarted.
Once you complete the above steps, you will no longer be able to share files from that particular folder share in Windows 11/10.
So these were some of the ways to Restrict Sharing a Folder in Windows 11/10. All of them are simple and need no specific tech knowledge. You can choose whichever seems more comfortable to you.
What is a shared folder in Windows?
Sharing a folder in the Windows file system is a special kind of workspace that lets you share the contents across all computers with which your account is associated and with other users.
Is file-sharing dangerous?
Sharing files can lead to malware infection, security breaches, or loss of confidential information. If proper security measures aren’t in place, files sharing can considerably outweigh the benefits and expose sensitive data in your company to newly emerging threats. In the course of our work, we sometimes need to share files and folders on our Windows PCs. However, if the security parameters do not meet the required levels, the data being shared will be accessible and visible to anyone, even if they are not authorized.