Dos commands

  • Thread starter Thread starter ksbrace
  • Start date Start date
K

ksbrace

Guest
Hello,
I am currently trying to make a program to grade my students java program. I want to be able to send command line commands such as 'javac' and 'java' to the Dos console via VB. I have tried using the Shell command and the API calls of ShellExecute and ShellExecuteEx, but, to no avail. Are there any other api calls that I can use to do this. I have a .bat file that simulates what I want to do, but it is UGLY and it doesn't do all that I would like it to do. Thanks in advance!!!
Kelly
 
According to AllAPI, the .NET equivalent for [api]ShellExecute[/api] is:
System.Diagnostics.Process.Start("path goes here")

It works for URL's, too, just like ShellExecute.

If you want to shorten it, add Imports System.Diagnostics
at the top of your code, then all you need to type is Process.Start
(if you didn't know that already).

HTH
 
Thanks for your response. I understand that, I'm trying to send commands to the DOS window. Such as 'java' & 'javac' to compile and run students java programs. Maybe I'm doing it wrong, but I think I have it correctly. When I put in a URL or a txt file the correct app opens them. But I want to control Dos from VB. Thanks in advance
 
It's not a DOS window, it's a 32bit Windows console window. As for your question, one of the overloads of Process.Start accepts a parameter of type ProcessStartInfo. One of the members of this type is RedirectStandardInput. Investigate this and you should be well on your way.
 
Urgent Help with DOS Command - Net View

ksbrace said:
Thanks for the help!

Can you tell me how to Run the DOS Command, Net View(which gives the Network Status) using ProcessStartInfo in VB .Net.
My Problem is that it asks for a Filename for the Command which i'm unable to locate.
Thanks in Advance for your Help

Srivalli
 
Back
Top