15

I'm attempting, using NAnt, to disconnect a share (in order to redirect it somewhere else) but my attempt fails:

[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] 

I can't see a way to supply the 'Yes' answer via the command line - there are not /Q switches. The target machine is a Windows 2003 server. Does DOS has an equivalent to the unix 'yes' command?

If I can do it on the command line, then I may be able to do it in NAnt's exec task.

3
  • sorry about the jumbled stream of consciousness. :S May 19, 2011 at 1:23
  • You use command.com too?
    – Hello71
    May 19, 2011 at 2:46
  • In actual fact this is part of a build and deployment tool. I'm using NAnt (a bit like make) to directly invoke the net command. May 19, 2011 at 7:14

2 Answers 2

18

The solution is to supply /Y to force the delete. This isn't documented, unfortunately.

1

Can't you just echo Y? If it's not using cmd, then just run it with %COMSPEC% /c echo Y | net....

2
  • Hi Hello71, Sadly it didn't work: May 19, 2011 at 2:58
  • same error of "no response provided" May 19, 2011 at 2:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .