虽然文件或文件夹共享是在家庭网络中共享文件的一种非常方便快捷的方式,但如果向公众开放可能会非常危险。仅供(Just)参考,当您允许将文件共享到任何网络时,会在您的 PC 上创建一个用户文件夹,其他人可以通过该文件夹访问您的“我的(Users)文档(Documents)”文件夹和桌面,这会使您的 PC 容易受到攻击。因此建议在Windows 11/10中限制文件夹共享。让我们学习如何做到这一点。
如何在Windows 11/10共享(Shared)文件夹
在我们继续如何停止文件夹共享之前,让我们首先了解如何检查您的任何文件夹是否被公开共享。
- 使用 fsmgmt.msc
- 使用命令行
1] 通过fsmgmt.msc
按 Win+R 打开运行对话框。
键入以下内容并按 Enter:
fsmgmt.msc
这将打开一个窗口,显示您 PC 上的所有共享文件夹。
2]通过命令行
Press Win+R并键入CMD打开Command-Line。
键入以下内容并按 Enter:
net share
然后命令行将显示您 PC 上的所有共享文件夹。
(Restrict Folder Sharing)在Windows 11/10限制文件夹共享
现在让我们看看如何在Windows 11/10文件夹共享(Folder Sharing):
- 通过资源管理器
- 通过删除访问
- 通过命令提示符
- 通过控制面板
- 使用 PowerShell
- 使用计算机管理。
1]通过文件资源管理器
- Press Win+E打开文件资源管理器(Explorer)。
- 转到您不想向公众开放的文件夹。
- 右键单击并打开属性。
- 转到共享(Sharing)并单击高级共享(Advanced Sharing)。
- 取消选中“共享此文件夹(Share this folder)”框
- 单击确定并应用。
2]通过删除访问
- 按 Win+E 打开文件资源管理器。
- 转到共享文件夹。
- 右键单击(Right-click)并转到授予访问权限(Access),然后单击删除访问权限(Remove Access)。
就是这样,你完成了。
3]通过命令提示符
您还可以通过命令提示符(Command Prompt)停止文件夹共享。
要打开命令提示符(Command Prompt),请在任务栏的搜索栏中键入命令提示符。(Type Command Prompt)
选择 Command Prompt(Select Command Prompt),右键单击,然后选择Run as Administrator。
键入net share以查看所有共享文件夹。
这将显示您 PC 上的所有共享文件夹。
找到您要限制共享的文件夹。
现在输入以下内容并按Enter 键(Enter),您就完成了。
net share (shared folder) /delete
例如,在这里我在我的Drive E中创建了一个(Drive E)Sharetest文件夹进行测试,现在通过命令提示符(Command Prompt)将其删除。
是的,命令提示符(Command Prompt)说共享(Share)测试已成功删除,但这仅意味着它不再共享。该文件夹在您的 PC 上仍然可用。
阅读(Read):如何在 Windows 11/10 中通过网络共享文件和文件夹
4]通过控制面板
- 按 Win+R 并键入控制面板(Control Panel)将其打开。
- 转到网络和共享中心。
- 单击更改高级共享设置。(Change Advanced Sharing Settings.)
- 转到所有网络。(All Networks.)
- 在公用文件夹共享(Public Folder Sharing)下,选择“关闭公用文件夹共享”选项(Turn off public folder sharing’)
- 单击保存更改。
关闭后,您与公众共享的所有文件夹都将被禁用。登录到这台电脑的人仍然可以查看和访问这些文件夹。
5]停止使用(Stop)PowerShell共享文件夹
如果您想在Windows 11/10Windows PowerShell共享文件夹,您可以按照以下说明进行操作:
- 您需要做的第一件事是启动提升的PowerShell提示符。您可以通过同时按Windows key + R来启动运行(Run)命令来执行此操作。
- 现在在文本框中键入PowerShell ,然后按(PowerShell)Ctrl+Shift+Enter键盘快捷键。如果UAC(UAC)出现在您的计算机屏幕上,请单击是(Yes)按钮。
- 在Windows PowerShell(Windows PowerShell)窗口中键入以下命令,然后按Enter。结果将显示Windows 11上的共享文件夹列表。
Get-SmbShare
- 接下来,键入以下命令并按Enter键。这将停止共享特定文件夹::
Remove-SmbShare -Name "(shared folder)"
- 在命令中,将(共享文件夹)更改为要停止的共享文件夹的名称。例如,我在 Drive D:中创建了一个“D$”文件夹进行测试,现在我正在使用PowerShell删除它。
- 要确认,请输入A并单击Enter。执行上述操作将停止在网络上共享文件夹。
6]在Windows 11/10停止与(Stop)计算机管理(Computer Management)共享文件夹
可以在其所在位置停止共享文件夹,但使用计算机管理(Computer Management)是最佳选择。这是因为它允许您从一个地方查看和控制所有共享。
以下是您可以使用计算机管理(Computer Management)停止文件共享的步骤:
- 按Windows key + S打开 Windows 搜索栏。
- 在搜索框中键入计算机管理(Computer Management),然后单击顶部结果。
- 从屏幕左侧展开共享文件夹(Shared Folders)部分。
- 单击共享(Shares)项。您现在应该右键单击屏幕右侧面板中的文件夹。
- 之后,选择停止共享(Stop Sharing) 以从网络中删除该文件夹。
- 当屏幕上出现一个弹出窗口时,单击是(Yes)按钮。
- 共享仅出于管理目的而创建,并且在计算机或服务器(Server)服务重新启动后会重新出现。
完成上述步骤后,您将无法再在Windows 11/10中共享该特定文件夹共享中的文件。
因此,这些是在Windows 11/10限制(Restrict)共享文件夹的一些方法。所有这些都很简单,不需要特定的技术知识。你可以选择你觉得更舒服的那个。
什么是 Windows 中的共享文件夹?
在Windows(Windows)文件系统中共享文件夹是一种特殊的工作区,可让您在与您的帐户关联的所有计算机以及其他用户之间共享内容。
文件共享危险吗?
共享文件可能导致恶意软件感染、安全漏洞或机密信息丢失。如果没有适当的安全措施,文件共享可能会大大超过好处,并使公司中的敏感数据面临新出现的威胁。在我们的工作过程中,我们有时需要在我们的Windows PC(Windows PCs)上共享文件和文件夹。但是,如果安全参数不符合要求的级别,则任何人都可以访问和查看共享的数据,即使他们未经授权。
现在阅读(Now Read)- 如何在用户帐户之间共享或传输文件。
How to stop Sharing a Folder in Windows 11/10
Whilе file or folder sharing is a very convenient and quick wаy to share your fіles within your home netwоrk, it could be really risky if open tо the publіc. Just for your informatіon, when you allow file sharing to any network, a Users folder iѕ crеated on your PС through which others can access your My Documеnts folder and the desktop and thiѕ makes yoυr PC vulnerable to the attacks. Thus it is recommended to restrict folder ѕharing 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:
fsmgmt.msc
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:
net share
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.
Get-SmbShare
- 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.
Now Read– How to share or transfer files between user accounts.