DOS中的NET USE

2009-02-01 6:53 am
Hi, 我有一個BAT file, 裡面用NET USE去中斷map咗嘅drive.
個command係: >NET USE e: /delete

但係有時佢會出個咁嘅message:

There are open files and/or incomplete directory searches pending on the connection to e:.

Is it OK to continue disconnecting and force them closed? (Y/N) [N]:

請問有咩辦法可以自動答"Y", 或者令佢唔好出呢個問題? 因為佢停咗喺度, 就唔可以繼續行bat file裡面其他command...

唔該晒~

回答 (2)

2009-02-01 9:01 am
✔ 最佳答案
Unfortunately the parameter /y for use in batch files does not seem to be documented when you type net use /? (brief help) or net use /help (detailed help).
However, if you type
net use e: /delete /y
it will go ahead and terminate the mapping, even though a file is open or in use. You will have to take the consequeces, if any, of this forced disconnection.
The /persistent:yes parameter refers to whether the mapping will be retained when you open your computer next time.
2009-02-01 7:16 am
試試加:
/PERSISTENT:YES
係/delete 後面



收錄日期: 2021-04-13 16:24:45
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20090131000051KK02165

檢視 Wayback Machine 備份