Net.exe Can Use Hidden Switches /Y /N for Unconditional Yes/NoID: Q156458
|
When you use Net.exe commands in a batch file, you can use the Y or N switch to unconditionally answer Yes or No to questions returned by the Net command.
Normally, you could pass a "Y" using Standard-in through redirection as in
the following example:
delshare.bat file contents:
NET SHARE TOOLS /D <y.txt
Y.txt file contents:
Y(cr) carriage return
NET SHARE TOOLS /D <y.txt
Users have open files on TOOLS. Continuing the operation will force the files closed.
Do you want to continue this operation? (Y/N) [N]:
No valid response was provided.
Change your batch file to include the Y switch to unconditionally answer
Yes to the question "Do you want to continue this operation? (Y/N) [N]:"
Delshare.bat new contents:
NET SHARE TOOLS /D /Y
NET SHARE TOOLS /D /y
Users have open files on TOOLS. Continuing the operation will force the
files closed.
TOOLS was deleted successfully.
Additional query words: std-in prodnt
Keywords : kbusage ntdomain ntutil
Version : 3.1 3.5 3.51 4.0
Platform : winnt
Issue type :
Last Reviewed: January 21, 1999