如果该共享上正在使用文件,则“ net share xyz / DELETE”将失败


14

我正在尝试使用NAnt断开共享(以便将其重定向到其他地方),但是我的尝试失败了:

[exec] Starting 'net (SHARE ad3-config /DELETE)' in 'c:\NAntDistributorBuilds\LocalInstallations\ad3config_master_1.0.19.4006'
[exec] Users have open files on ad3-config.  Continuing the operation will force the files closed.
[exec] No valid response was provided.
[exec] 
[exec] Do you want to continue this operation? (Y/N) [N]: 
[exec] c:\NAntDistributorBuilds\LocalInstallations\ad3config_master_1.0.19.4006\install.build(32,6):
[exec] External Program Failed: net (return code was -1)
[exec] Starting 'net (SHARE ad3-config="c:\NAntDistributorBuilds\LocalInstallations\ad3config_master_1.0.19.4006" /UNLIMITED)' in 'c:\NAntDistributorBuilds\LocalInstallations\ad3config_master_1.0.19.4006'
[exec] The name has already been shared.
[exec] 
[exec] More help is available by typing NET HELPMSG 2118.
[exec] 

我看不到通过命令行提供“是”答案的方法-没有/ Q开关。目标计算机是Windows 2003服务器。DOS是否具有与unix“ yes”命令等效的功能?

如果我可以在命令行上执行此操作,则可以在NAnt的exec任务中执行。


对意识混乱的情况感到抱歉。:S
安德鲁·马修斯

你也用command.com吗?
Hello71

实际上,这是构建和部署工具的一部分。我正在使用NAnt(有点像make)直接调用net命令。
安德鲁·马修斯

Answers:



By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.