净使用/删除错误85

时间:2014-02-07 11:38:58

标签: batch-file cmd

我正在尝试创建一个简单的批处理文件,允许我添加和删除网络驱动器,但当我尝试删除驱动器时,我收到错误85“本地设备名称已被使用”。

当我在cmd窗口中单独输入net use /delete G:时,它可以正常工作

任何帮助将不胜感激

以下是相关的代码:

:remove
echo ---------------------------------------
echo Which drive would you like to remove?
echo.
echo 1. B: drive 
echo 2. G: drive 
echo 3. H: drive 
echo 4. I: drive 
echo 5. J: drive 
echo 6. N: drive 
echo 7. P: drive 
echo 8. V: drive 
echo. 
echo 0. Back
echo ---------------------------------------
set /p choice="Enter your choice: "
if "%choice%"=="1" goto remB
if "%choice%"=="2" goto remG
if "%choice%"=="3" goto remH
if "%choice%"=="4" goto remI
if "%choice%"=="5" goto remJ
if "%choice%"=="6" goto remN
if "%choice%"=="7" goto remP
if "%choice%"=="8" goto remV
if "%choice%"=="0" goto start
echo Invalid choice: %choice%
echo.
pause
cls
goto remove

:remB
cls
net use B: \delete
goto remove

:remG
cls
net use G: \delete
goto remove

:remH
cls
net use H: \delete
goto remove

:remI
cls
net use I: \delete
goto remove

:remJ
cls
net use J: \delete
goto remove

:remN
cls
net use N: \delete
goto remove

:remP
cls
net use P: \delete
goto remove

:remV
cls
net use V: \delete
goto remove

0 个答案:

没有答案