コマンドライン – “net share xyz /DELETE” は、その共有上でファイルが使用中の場合に失敗します

command-line network-shares windows-server-2003

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タスクでできるかもしれませんね

  15  Andrew Matthews  2011-05-19


ベストアンサー

解決策は、/yを与えて強制的に削除することです。これは残念ながら、文書化されていません

18  Nick Westgate  2011-11-09


echo Yじゃダメなの?cmd使ってないなら%COMSPEC% /c echo Y | net...で実行すればいいんじゃない?

1  Hello71  2011-05-19


タイトルとURLをコピーしました