- @echo off
- set str=
- for /f "skip=1" %%a in ('wmic logicaldisk where "drivetype='2'" get DeviceID 2^>nul') do call :concat %%a
-
- if "%str%" == "" (
- echo 没有发现移动磁盘,请检查是否插入!
- ) else (
- echo 发现移动磁盘%str%
- )
-
- pause > null
-
- ::对参数进行拼接
- :concat
- set str=%str%%1
- goto :eof
复制代码
|