954,167 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

DOS "ROUTE" command

Does anyone know of a way to invoke the DOS "ROUTE" command(s). I have written a .bat program that adds routes, but I want to take a particular interface from my ROUTE PRINT output and then ROUTE ADD the routes to that interface. Since that interface is dynamic due to VPN issues, it would be great if I could write a little program that would first determine the interface ID (such as 0x2000005) and then create the routes via ROUTE ADD. TIA.

-jcs

JCSAYRE
Newbie Poster
2 posts since Sep 2003
Reputation Points: 10
Solved Threads: 0
 

I think I'm missing something... Where is your question? hehe

Tekmaven
Software Architect
Moderator
1,274 posts since Feb 2002
Reputation Points: 322
Solved Threads: 28
 

It's been brought to my attention that my quetion isn't very clear, which I have to agree with. Here's my question:
In Vis.Basic, how can I determine the active interfaces on my computer? I can do this with the DOS command, "ROUTE PRINT" but I would like to be able to do something like the following psuedo-code:

DIM WAN, TEMP AS STRING
DIM IPADDRESS, GATEWAY AS STRING

IPADDRESS = "1.2.3.4" 'YES I KNOW THIS IS A BOGUS IP ADDY
GATEWAY = "5.6.7.8" ''YES I KNOW THIS IS A BOGUS IP ADDY TOO

TEMP = ROUTE PRINT | FIND "WAN"
WAN = MID (TEMP,2,7)
ROUTE ADD IPADDRESS GATEWAY METRIC 2 IF (THIS IS INTERFACE, NOT "IF" STATEMENT) WAN

What I don't know how to do is determine the active interfaces, routes, etc. from visual basic. I can do it from DOS, but I want to do it from VB. I am sure that there's some API or DLL that I should be using, but I can't seem to figure it out. So, how do I call the DOS command, "ROUTE" from visual basic?

JCSAYRE
Newbie Poster
2 posts since Sep 2003
Reputation Points: 10
Solved Threads: 0
 

Shell("C:\Path\to\app.exe")

Tekmaven
Software Architect
Moderator
1,274 posts since Feb 2002
Reputation Points: 322
Solved Threads: 28
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You