Created
July 28, 2019 04:10
-
-
Save sasapurin/7fbe4fe304fd627a4131d995bbfec6fe to your computer and use it in GitHub Desktop.
CHECK STATUS and RESTART of USB Device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM This Script Need the devcon.exe (Include Microsoft WDK) | |
echo off | |
setlocal | |
REM Make Tempfile PATH | |
set TMP_FILE=%~dp0tmp_status.log | |
REM Define USB Device ID | |
set USB_DEV_ID="USB\VID_0590&PID_0081&REV_0109" | |
REM Run the Get STATUS of USB Device | |
%windir%\devcon.exe status %USB_DEV_ID% > %TMP_FILE% | |
REM Check STATUS. and Excec RESTART | |
find /i "Driver is running." %TMP_FILE% > nul | |
if not %ERRORLEVEL% equ 0 ( | |
%windir%\devcon.exe restart %USB_DEV_ID% > %TMP_FILE% | |
if exist %TMP_FILE% ( del %TMP_FILE% ) | |
exit /b 1 | |
) | |
if exist %TMP_FILE% ( del %TMP_FILE% ) | |
endlocal | |
exit /b 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment