Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting where an LPT port is connected

Status
Not open for further replies.

asid

Programmer
Aug 19, 2002
13
0
0
AU
Hello

From a command window I can type "Net Use" (no quotes) to display a list of network and printer connections, returning something like this:

F: \\Server\APPS\WP51
M: \\Server\VOL1
LPT2 \\Tree\OU\OU\Printing\HP_M_Q

Does anyone know how I can access this data via VBA so I can then parse it and get the location that LPT2 is connected to?

Please let me know if you require further information
 
One way to do this is to run the 'command' to a text file and then read the contents of the file. Use a line like this to create the text file :-

Shell "command.com /c net use > c:\temp\temp.txt"

This will open a command prompt window and run your "net use" command directly to a temporary text file (temp.txt).

You will then need some code to locate (parse) your string. Refer to a this thread (thread707-640737) posted recently for some help on that

Good luck,
TopJack.



 
TopJack, that might just about do it.

Many thanks

Antony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top