Jump to content
Xtreme .Net Talk

Dos commands


Recommended Posts

Posted

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

  • *Experts*
Posted

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

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted
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
  • *Gurus*
Posted
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.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

  • 1 year later...
Posted

Urgent Help with DOS Command - Net View

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...