Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for mdmcmds.bat

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

  1. @ECHO OFF
  2. :: Check Windows version
  3. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  4.  
  5. :: Use local ERROR variable
  6. SETLOCAL
  7. SET Error=0
  8.  
  9. :: Check command line arguments (none required)
  10. IF NOT "%~1"=="" GOTO Syntax
  11.  
  12. :: Display header
  13. FOR /F "tokens=1* delims==" %%A IN ('WMIC Path Win32_POTSModem Get Model /Format:list 2^>NUL ^| FIND "="') DO (
  14. 	ECHO.
  15. 	ECHO Configuration commands for %%B
  16. 	ECHO.
  17. 	FOR /F "tokens=*" %%C IN ('ECHO.%%B') DO (
  18. 		WMIC Path Win32_POTSModem Where "Model='%%C'" Get BlindOff,BlindOn,CompressionOff,CompressionOn,ErrorControlForced,ErrorControlOff,ErrorControlOn,FlowControlHard,FlowControlOff,FlowControlSoft,ModulationBell,ModulationCCITT,Prefix,Pulse,Reset,SpeakerModeDial,SpeakerModeOff,SpeakerModeOn,SpeakerModeSetup,SpeakerVolumeHigh,SpeakerVolumeLow,SpeakerVolumeMed,Terminator,Tone /Format:list | FIND "="
  19. 		IF ERRORLEVEL 1 SET Error=1
  20. 	)
  21. )
  22.  
  23. :: Final check for WMIC errors
  24. IF "%Error%"=="1" GOTO Syntax
  25.  
  26. :: Done
  27. ENDLOCAL
  28. GOTO:EOF
  29.  
  30.  
  31. :Syntax
  32. ECHO.
  33. ECHO MdmCmds.bat,  Version 1.00 for Windows XP Professional and later
  34. ECHO Display the (AT) configuration commands available for your modem(s).
  35. ECHO.
  36. ECHO Usage:  MDMCMDS
  37. ECHO.
  38. ECHO Note:   This batch file uses WMIC.EXE, which is available
  39. ECHO         in Windows XP Professional and Windows Server 2003
  40. ECHO.
  41. ECHO Written by Rob van der Woude
  42. ECHO http://www.robvanderwoude.com
  43. IF "%OS%"=="Windows_NT" ENDLOCAL
  44. EXIT /B 1
  45.  

page last uploaded: 2017-07-06, 12:37