2

共享和重新共享文件夹。我得到了重新共享的部分,我被困在的是取消共享。

我使用此代码

NET SHARE d:\文件夹名/删除

这会删除共享,但如果有人访问该文件夹,则会提示继续,现在我希望这个批处理文件在没有任何提示的情况下静默运行。有什么想法吗 ?

4

3 回答 3

1

这是我想的更容易的一个:)

NET SHARE d:\foldername /Y /delete
于 2012-01-18T15:50:11.903 回答
0

将其放入文件 yes.txt

Y [Newline]

现在

type yes.txt | NET SHARE d:\foldername /delete
于 2012-01-18T02:44:43.383 回答
0

实际上没有必要提及完整路径。Windows会自己弄清楚并删除。也不会意外删除两个具有相同名称@不同位置的文件夹,因为这是不允许的。您必须提供不同的共享名称。所以这会很好用“碎片”是我桌面上的一个文件夹

NET SHARE  foldername /Y /delete

请参阅下面的用例演示

    C:\Users\Administrator>net share \\w7\*  /y /delete
This shared resource does not exist.

More help is available by typing NET HELPMSG 2310.


C:\Users\Administrator>net share \\w7\users  /y /delete
This shared resource does not exist.

More help is available by typing NET HELPMSG 2310.


C:\Users\Administrator>net share c:\users  /y /delete
Users was deleted successfully.

c:\users was deleted successfully.


C:\Users\Administrator>net share c:\  /y /delete
C$ was deleted successfully.


c:\ was deleted successfully.


C:\Users\Administrator>net share c:\shard /y /delete
A matching share could not be found so nothing was deleted.

More help is available by typing NET HELPMSG 3719.


C:\Users\Administrator>net share shard /y /delete
shard was deleted successfully.
于 2015-06-15T12:15:35.713 回答