[Btach] How to include only the folders with a *inf file.

Discussion in 'Scripting' started by Outbreaker, Apr 16, 2020.

  1. Outbreaker

    Outbreaker MDL Member

    Jan 20, 2018
    109
    17
    10
    Hi,
    Dose someone know how to modify this script below so that it would only include the folders that have an *.inf file in them?
    Code:
    @ECHO OFF
    setlocal enableExtensions enableDelayedExpansion
    Set "devicePath=%%SystemRoot%%\Inf" & For /d /r "%%SystemDrive%%\Drivers\" %%? in ("*") do Set "devicePath=!devicePath!;%%~?"
    echo !devicePath!
    Pause
     
  2. Outbreaker

    Outbreaker MDL Member

    Jan 20, 2018
    109
    17
    10
    I found the solution to my problem:
    Code:
    For /f "tokens=*" %%? in ('Dir /b /s /a:d "%%SystemDrive%%\D\*"') do If Exist "%%?\*.inf" Set "DevicePath=!DevicePath!;%%?"
    echo !DevicePath:\=\\!