

InterviewSolution
Saved Bookmarks
1. |
Solve : I can get my batch file to run when I run the batch file using devcon.exe? |
Answer» <html><body><p>But, When I use C# to run a form and try running file below it doesn't work. Even though I have devcon.exe in the same folder as the batch file. If I run it by itself it works. <br/><br/>Unload_USB.bat <a href="https://interviewquestions.tuteehub.com/tag/code-25512" style="font-weight:bold;" target="_blank" title="Click to know more about CODE">CODE</a> below<br/><br/>ECHO OFF<br/>:: Check Windows <a href="https://interviewquestions.tuteehub.com/tag/version-1444891" style="font-weight:bold;" target="_blank" title="Click to know more about VERSION">VERSION</a><br/>IF NOT "%<a href="https://interviewquestions.tuteehub.com/tag/os-25550" style="font-weight:bold;" target="_blank" title="Click to know more about OS">OS</a>%"=="Windows_NT" GOTO Syntax<br/>IF "%OS%"=="Windows_NT" SETLOCAL<br/>VER | FIND "Windows NT" >NUL &<a href="https://interviewquestions.tuteehub.com/tag/amp-363144" style="font-weight:bold;" target="_blank" title="Click to know more about AMP">AMP</a>;& GOTO Syntax<br/><br/>:: Check command line arguments -- none required<br/>IF NOT "%~1"=="" GOTO Syntax<br/><br/>:: Check if DEVCON.EXE is available and if not, prompt for download<br/>SET DevconAvailable=<br/>SET Download=<br/>DEVCON.EXE /? >NUL 2>&1<br/>IF ERRORLEVEL 1 (<br/> SET DevconAvailable=No<br/> ECHO This batch file requires Microsoft's DEVCON untility.<br/> SET /P Download=Do you want to download it now? [y/N] <br/>)<br/><br/>:: Start download if requested<br/>IF /I "%Download%"=="Y" (<br/> START "DevCon" "<a href="https://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272">http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272</a>"<br/> ECHO.<br/> ECHO Install the downloaded file and make sure DEVCON.EXE is in the <a href="https://interviewquestions.tuteehub.com/tag/path-11833" style="font-weight:bold;" target="_blank" title="Click to know more about PATH">PATH</a>.<br/> ECHO Then try again.<br/>)<br/><br/>:: Abort if DEVCON.EXE is not available yet<br/>IF "%DevconAvailable%"=="No" GOTO End<br/><br/>:: Patch registry first<br/>CALL UsbRegistryKey.reg<br/><br/>:: List all USB EHCI devices<br/>>> FindEHCI.dat ECHO.%Date%, %Time%<br/>DEVCON listclass USB | FIND "Enhanced" >> FindEHCI.dat<br/>FOR /F "tokens=1 delims=: " %%A IN ('DEVCON FindAll ^=USB ^| FIND "Enhanced"') DO DEVCON disable "%%A"<br/>ENDLOCAL<br/>GOTO End<br/><br/>:Syntax<br/>ECHO.<br/>ECHO FindDisable_EHCI.bat, Version 1.00 for Windows 2000 / XP<br/>ECHO Use DEVCON to remove all USB devices and then scan for new devices<br/>ECHO.<br/>ECHO Usage: USBclass<br/>ECHO.<br/>ECHO Notes: [1] This batch file requires Microsoft's DEVCON.EXE, available at<br/>ECHO http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272<br/>ECHO You will be prompted for download if it isn't found.<br/>:End<br/><br/><br/>Thanks for help</p></body></html> | |