Is it possible to open a DOS command window and send commands and parse the output? I have an application where I need to communicate to my device over Ethernet though a custom DOS program.
Here's a script I wrote a while back that would open a DOS window to run ipconfig and grab the local machine's IP address. I've not tried it lately, hopefully it still works OK on Windows 7 or later. I think this should get you started at least.
proc main
string sLine, sIP
dos "ipconfig > c:\ip.txt"
pause 3
fopen 0 "c:\ip.txt" READ TEXT
while not feof 0
fgets 0 sLine
if strfind sLine "IP Address"
strextract sIP sLine ":" 1
strreplace sIP " " ""
strreplace sIP "`n" ""
strreplace sIP "`r" ""
endif
endwhile
fclose 0
delfile "c:\ip.txt"
endproc
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.