Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for modems.bat

(view source code of modems.bat as plain text)

  1. @ECHO OFF
  2. :: Check Windows version and command line arguments
  3. IF NOT "%~1"=="" GOTO Syntax
  4. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  5. VER | FIND "Windows NT" >NUL
  6. IF NOT ERRORLEVEL 1 GOTO Syntax
  7.  
  8. :: Use local environment copy
  9. SETLOCAL
  10.  
  11. :: Check if DEVCON.EXE is available and if not, offer to download it
  12. SET Download=N
  13. DEVCON.EXE /? >NUL 2>&1
  14. IF ERRORLEVEL 1 (
  15. 	ECHO This batch file requires Microsoft's DEVCON untility.
  16. 	SET /P Download=Do you want to download it now? [y/N] 
  17. )
  18.  
  19. :: Start either download or use DEVCON.EXE to display installed modems
  20. IF /I "%Download%"=="Y" (
  21. 	START "DevCon" "http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272"
  22. ) ELSE (
  23. 	ECHO.
  24. 	DEVCON.EXE resources =modem 2>NUL | FIND ": "
  25. )
  26. ENDLOCAL
  27. GOTO:EOF
  28.  
  29. :Syntax
  30. ECHO.
  31. ECHO Modems.bat,  Version 1.01 for Windows 2000 / XP
  32. ECHO Display locally installed modems and the resources they use
  33. ECHO.
  34. ECHO Usage:  MODEMS
  35. ECHO.
  36. ECHO This batch file uses DEVCON, a command line utility by Microsoft,
  37. ECHO used to list, install or remove devices, or change their settings.
  38. ECHO This batch files demonstrates how to simply list all available modems.
  39. ECHO The actual command to list modems is: DEVCON.EXE resources =modem
  40. ECHO If DEVCON is not found on the computer, you will be prompted to download
  41. ECHO it at http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272
  42. ECHO.
  43. ECHO Written by Rob van der Woude
  44. ECHO http://www.robvanderwoude.com
  45.  

page last uploaded: 2017-08-21, 14:26