Add scripts to uninstall Windows drivers as well
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

This commit is contained in:
Lorenzooone
2026-05-28 00:07:13 +02:00
parent 45a637034a
commit 4ca806ebec
5 changed files with 175 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
@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.

View File

@@ -0,0 +1,74 @@
@echo off
setlocal enabledelayedexpansion
:: Usage:
:: driver_remover.bat vid pid
::
:: For removing LibUSB-based drivers
::
:: Example:
:: driver_remover.bat 04B4 8613
if "%~2"=="" (
echo Usage: %~nx0 VID PID
exit /b 1
)
set VID=%~1
set PID=%~2
set TARGET=VID_%VID%^&PID_%PID%
set FOUND=
set PREVIOUS=
set PREVIOUS2=
set PREVIOUS3=
set PREVIOUS4=
set PREVIOUS5=
set PREVIOUS6=
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
echo "!VALUE!" | find /I "%TARGET%" >nul
:: Second field = original INF name
if not errorlevel 1 (
set "FOUND=!PREVIOUS6!"
)
set PREVIOUS6=!PREVIOUS5!
set PREVIOUS5=!PREVIOUS4!
set PREVIOUS4=!PREVIOUS3!
set PREVIOUS3=!PREVIOUS2!
set PREVIOUS2=!PREVIOUS!
set PREVIOUS=!VALUE!
)
)
if "%FOUND%"=="" (
echo Driver not found.
exit /b 2
)
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.
exit /b 0

View File

@@ -25,6 +25,7 @@ if '%errorlevel%' NEQ '0' (
CD /D "%~dp0"
:--------------------------------------
call "subscripts\driver_remover_name_based.bat" intraoralsensor.inf
call "subscripts\driver_uninstaller_currently_connected.bat" 04B4 8613
call "subscripts\driver_uninstaller_currently_connected.bat" 0752 8613

View File

@@ -0,0 +1,37 @@
@echo off
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
call "..\subscripts\driver_uninstaller_currently_connected.bat" 04B4 8613
call "..\subscripts\driver_uninstaller_currently_connected.bat" 0752 8613
call "..\subscripts\driver_uninstaller_currently_connected.bat" 04B4 1004
call "..\subscripts\driver_remover_vid_pid_based.bat" 04B4 8613
call "..\subscripts\driver_remover_vid_pid_based.bat" 0752 8613
call "..\subscripts\driver_remover_vid_pid_based.bat" 04B4 1004
call "..\subscripts\driver_remover_name_based.bat" cyusb3.inf