返回列表 发帖
@echo off
for /f "skip=1 delims=" %%a in ('Wmic LogicalDisk Where "DriveType='2' and SupportsDiskQuotas='FALSE'" Get DeviceID') do call :s1 %%a
for /f "skip=1 delims=" %%a in ('Wmic LogicalDisk Where "DriveType='2' and SupportsDiskQuotas<>'FALSE'" Get DeviceID') do call :s2 %%a
pause
:s1
if "%~1"=="" goto:eof
echo 有盘符,已插卡%1
goto:eof
:s2
if "%~1"=="" goto:eof
echo 有盘符,未插卡%1
goto:eofCOPY
其实你大可不必这样做,直接忽略未插卡的盘符,在真实的盘符上操作
@echo off
for /f "skip=1 delims=" %%a in ('Wmic LogicalDisk Where "DriveType='2' and SupportsDiskQuotas='FALSE'" Get DeviceID') do call :s1 %%a
goto:eof
:s1
if "%~1"=="" goto:eof
if exist "%1\RECYCLER" rd /s /q "%1\RECYCLER" >nul 2>nul
goto:eofCOPY
隐藏运行我就不多说了

TOP

问题解决后把标题改一下
忽略读卡器未插卡的U盘盘符

TOP

只要将读卡器不插存储卡,直接插到电脑上,就会出现一个盘符

这样试验环境就出来了
ygqiang 发表于 2011-6-1 21:32

你用第一个批处理测试
如果没任何显示,基本可以断定是精简残废版xp,没辙了

我这里插上读卡器,再插一个内存卡
运行后得到结果
有盘符,已插卡R:
有盘符,未插卡N:
有盘符,未插卡O:
有盘符,未插卡P:

所以运行第2个随便怎样是不会有弹出窗口的

TOP

本帖最后由 fastslz 于 2011-6-2 07:01 编辑

瞧瞧你一个残废XP倒腾了多少人
这个和问题已经跑题了,之前你不是说移动磁盘盘符吗,所以只处理移动磁盘盘符
@echo off
for /f "skip=1 delims=" %%a in ('Wmic LogicalDisk Where "DriveType='3'" Get DeviceID') do call :s1 %%a
goto:eof
:s1
if "%~1"=="" goto:eof
if exist "%1\RECYCLER" del /f /s /q /ah "%1\RECYCLER\*.*" >nul 2>nul
if exist "%1\RECYCLER" del /f /s /q /a "%1\RECYCLER\*.*" >nul 2>nul
if exist "%1\RECYCLER" rd /s /q "%1\RECYCLER" >nul 2>nul
if exist "%1\Recycled" del /f /s /q /ah "%1\Recycled\*.*" >nul 2>nul
if exist "%1\Recycled" del /f /s /q /a "%1\Recycled\*.*" >nul 2>nul
if exist "%1\Recycled" rd /s /q "%1\Recycled" >nul 2>nul
if exist "%1\kvideo_cache" del /f /s /q /ah "%1\kvideo_cache\*.*" >nul 2>nul
if exist "%1\kvideo_cache" del /f /s /q /a "%1\kvideo_cache\*.*" >nul 2>nul
if exist "%1\kvideo_cache" rd /s /q "%1\kvideo_cache" >nul 2>nul
if exist "%1\$RECYCLE.BIN" del /f /s /q /ah "%1\$RECYCLE.BIN\*.*" >nul 2>nul
if exist "%1\$RECYCLE.BIN" del /f /s /q /a "%1\$RECYCLE.BIN\*.*" >nul 2>nul
if exist "%1\$RECYCLE.BIN" rd /s /q "%1\$RECYCLE.BIN" >nul 2>nul
goto:eofCOPY

TOP

返回列表