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开发者_Python百科 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.
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.
you can use Process.Start static Method MSDN Link
精彩评论