2012-01-18 70 views
2

共享並重新共享文件夾。我得到了重新分享的部分,我堅持的是不共享。使用批處理文件靜默取消共享文件夾

我使用此代碼

NET SHARE d:\文件夾/刪除

它刪除的份額,但如果還有人訪問該文件夾中有提示,繼續,現在我想這個批處理文件來運行默默地沒有任何提示。有什麼想法嗎 ?

+0

我想通了:) NET SHARE d:\文件夾/ Y /刪除 – 2012-01-18 02:43:52

回答

1

這是我想通了一個更容易:)

NET SHARE d:\foldername /Y /delete 
0

要把它放到一個文件yes.txt

Y [Newline] 

現在

type yes.txt | NET SHARE d:\foldername /delete 
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. 
相關問題