cc3dsfs/driver_scripts/driver_remover_name_based.bat
Lorenzooone 4ca806ebec
Some checks failed
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux32 flags:32 name:Linux GCC 32 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux64 flags:64 name:Linux GCC x64 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm32 flags:arm32 name:Linux GCC ARM 32 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm64 flags:arm64 name:Linux GCC ARM 64 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:macos name:macOS Apple Silicon os:macos-14]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win32 flags:-A Win32 -DCMAKE_PARALLEL_MSVC=TRUE -DCMAKE_PREPARE_WINDOWS_DRIVERS=TRUE name:Windows VS2022 Win32 os:windows-2022]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win64 flags:-A x64 -DCMAKE_PARALLEL_MSVC=TRUE -DCMAKE_PREPARE_WINDOWS_DRIVERS=TRUE name:Windows VS2022 x64 os:windows-2022]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:winarm64 flags:-A ARM64 -DCMAKE_PARALLEL_MSVC=TRUE -DCMAKE_PREPARE_WINDOWS_DRIVERS=TRUE name:Windows VS2022 ARM os:windows-2022]) (push) Has been cancelled
CD / Create Pi Mono Setup (push) Has been cancelled
CD / Publishing (push) Has been cancelled
Add scripts to uninstall Windows drivers as well
2026-05-28 00:07:13 +02:00

60 lines
1.1 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
:: Usage:
:: driver_remover.bat originalname.inf
::
:: Example:
:: driver_remover.bat cyusb3.inf
:: driver_remover.bat nstd_usb.inf
:: driver_remover.bat nstd_usb_new.inf
:: driver_remover.bat intraoralsensor.inf
if "%~1"=="" (
echo Usage: %~nx0 OriginalDriverName.inf
exit /b 1
)
set TARGET=%~1
set FOUND=
set PREVIOUS=
for /f "delims=" %%L in ('pnputil /enum-drivers') do (
set LINE=%%L
:: Split on first colon
for /f "tokens=1,* delims=:" %%A in ("!LINE!") do (
set VALUE=%%B
:: Trim leading spaces
for /f "tokens=* delims= " %%X in ("!VALUE!") do set VALUE=%%X
:: Second field = original INF name
if /I "!VALUE!"=="%TARGET%" (
set "FOUND=!PREVIOUS!"
)
set PREVIOUS=!VALUE!
)
)
if "%FOUND%"=="" (
echo Driver not found.
exit /b 1
)
echo Found: %FOUND%
echo Removing driver...
pnputil /delete-driver %FOUND% /uninstall /force
if errorlevel 1 (
echo Failed to remove driver.
exit /b 1
)
echo Driver removed successfully.