如何从 Windows 命令行创建共享文件夹?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1537065/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I create a shared folder from the Windows command line?
提问by KdgDev
As far as I'm aware, this is done via the net
command.
据我所知,这是通过net
命令完成的。
However, the help section isn't very helpful, as it only shows me the secondary options and not how to use those.
然而,帮助部分并不是很有帮助,因为它只向我展示了次要选项,而不是如何使用这些选项。
Suppose I had a folder C:\Share_test
假设我有一个文件夹 C:\Share_test
How would I make it shared from the command line?
我如何让它从命令行共享?
回答by Sinan ünür
C:\>
net help share
C:\>
net help share
For example:
例如:
To share a computer's
C:\Data
directory with the share nameDataShare
and include a remark, type:
net share DataShare=c:\Data /remark:"For department 123."
要
C:\Data
使用共享名共享计算机目录DataShare
并包含注释,请键入:
net share DataShare=c:\Data /remark:"For department 123."
回答by Dave Lucre
Using the "net help share" command you will see that the syntax is as follows:
使用“net help share”命令你会看到语法如下:
net share sharename=drive:path
For example, if I had a folder S:\Public which I wanted to share as "Public" the command would be:
例如,如果我有一个文件夹 S:\Public,我想将其共享为“Public”,则命令将是:
net share Public=s:\Public
The above command will automatically grant "Everyone" with Read permissions only. If you want to grant Everyone with Full Control the command would be:
上述命令将自动授予“Everyone”只读权限。如果你想授予每个人完全控制的命令是:
net share Public=s:\Public /GRANT:Everyone,FULL
Keep in mind that NTFS permissions still apply, so even though you might have granted EVERYONE with FULL access to the share, you'll still have to check the NTFS security permissions to ensure that the right people have permission there too.
请记住,NTFS 权限仍然适用,因此即使您可能已授予每个人对该共享的完全访问权限,您仍然必须检查 NTFS 安全权限以确保合适的人也拥有该权限。