用于查找已安装设备的驱动器号的批处理脚本

Wit*_*eso 5 windows batch-file

我正在尝试编写一个批处理脚本来定位特定安装的设备。我在 Windows 7 中。

我知道该设备将具有文件夹 drive:\custom 所以我想查看所有可能性以找到具有此路径的设备

这是我到目前为止所拥有的

    @echo off
   setLocal Enabledelayedexpansion


for %%d in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
  if exist %%d:\custom (
     ECHO Device Found : %%d
  )
)
Run Code Online (Sandbox Code Playgroud)

但这不起作用,它认为它存在于每个驱动器号..所以我看到每个驱动器号的“设备找到”。这是为什么?我这样做是错误的吗?如何在根目录中找到包含“custom”文件夹的驱动器号?

谢谢,
斯蒂芬妮

And*_*y M 2

\在路径末尾添加:

IF EXIST %%d:\custom\ (...)
Run Code Online (Sandbox Code Playgroud)