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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get cmd command results

Status
Not open for further replies.

falled

Programmer
Nov 3, 2006
47
ES
I want to execute "net use" command to configure the printers. How can I execute and return the results?
 
Why not configure the printers through .NET?

Otherwise you can use the ProcessStartInfo Class

____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done
 
Well I've got two computers. One of them (A) have a very old printer and other newer, and the other computer (B) wants to send works to the old one.

The software that uses B only can print using lpt1 (don't ask me why) And every time B wants to print with the old printer from A i must redirect it. I can't connect the old printer directly to B. I just one two make a little software that let me choose and see whitch printer is connected in the LPT1 port.

I know it's a little difficult and maybe it's a better way to do all this.

Thank you for answer me and sorry for my bad writting.
 
A few things:
Have you tried setting up the printer as a network printer on the local pc? It would do all this automatically.
If so I would have thought that you would see it in the System.Drawing.Printing.PrinterSettings.InstalledPrinters() list?
If not, then try it. it should work using raw or ftp printing.

Otherwise i just posted on ProcessStartInfo: thread796-1320239
 
Yes, on the one hand the scene is a little more complex than that.

The application only must talk between two computers (threads)

The application contains two icons of two printers, the old computer and the laser. from the two computers, if I click on a printer, the app must warn the other about the change, and change it.

On the other hand is a challenge for me, and a chance to learn how it works all this stuff

That's all. xD


 
So you are tring to create your own print server application?
And, your setup is:

App(Print Server) PC with a printer
Old PC with another printer

And you want both PCs to send the doc to print to your App, for it to deside where to print to?

If i am right so far, then you need to create a ftp server?
 
No exactly....

The problem is the business management software wich only supports a printer.

Yes I know (why not change the software provider... xD), I only can use one printer and this PC have two printers wich to PCs must use. If I one to print bills I use the new and for the other formats the old one (because have continous paper... etc)

As I said before The business management software only supports the LPT1 port (year 2007, xD) it's because of this I must change the printer every time each PC wants to print each format :_(

With this app I'll change the printer from each computer and that's all

Sorry for this large text and sorry for my bad writting too.

Thank for read it
 
Well, if i'm understanding what you are tring to do right, i would go with the windows network printer management option.

But if you are just doing this for fun then: thread796-1320239 gives you some code to play with 'net use'.

The two lines:
Code:
        info.FileName = "ping"
        info.Arguments = PCAddress & " -n 1 -w 100" '-n is count, -w is timeout milliseconds
are where you set the command (.FileName="net use") and the arguments.
Replace the code after tmp = sout.ReadToEnd() to do your retreiving code, tmp is the full response of the command.
You may need to use System.Text.RegularExpressions.Regex class to find the information you need from the response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top