Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
    
sorry about the jumbled stream of consciousness. :S – Andrew Matthews May 19 '11 at 1:23
    
You use command.com too? – Hello71 May 19 '11 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. – Andrew Matthews May 19 '11 at 7:14

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

share|improve this answer

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

share|improve this answer
    
Hi Hello71, Sadly it didn't work: – Andrew Matthews May 19 '11 at 2:58
    
same error of "no response provided" – Andrew Matthews May 19 '11 at 2:59

You must log in to answer this question.

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