Kuzon
Kuzon

Reputation: 822

Is is possible to run cmd commands straight from VB

Is is possible to run cmd commands straight from VB. I want to be able to set up a command in vb without showing the black cmd window

path= C:\Program Files (x86)\Java\jre6\bin
java -Xmx1024M -Xms1024M -jar minecraft.jar nogui

Is it possible to run it without making a batch file? ( I want be be able to change some of the values in the commands to)

I found Shell(pathname[,windowstyle]) but I am not quite sure how to use it or if it is the right code.

Upvotes: 1

Views: 1493

Answers (2)

Gaurav Saxena
Gaurav Saxena

Reputation: 155

you can use Process.Start static Method MSDN Link

Upvotes: 0

Oded
Oded

Reputation: 498972

You can use the Process class.

Dim pi As new ProcessStartInfo("C:\Program Files (x86)\Java\jre6\bin\java")
pi.Arguments = "-Xmx1024M -Xms1024M -jar minecraft.jar nogui"

Process.Start(pi)

I have use ProcessStartInfo to hold the process information before starting it off.

Upvotes: 6

Related Questions