This should be so easy!

  • Thread starter Thread starter Garrett
  • Start date Start date
G

Garrett

Hi all, I am trying to run calc from the command line using a Process.
I am clearly missing something obvious here because the command line
opens but the "Calc" arg never executes...code below...thanks.



Module Module1

Sub Main()
Dim proc As New Process()
Dim info as ProcessStartInfo = new ProcessStartInfo("cmd.exe",
"calc")
proc.StartInfo = info
proc.EnableRaisingEvents = true
proc.Start()
proc.WaitForExit()
End Sub

End Module
 
"calc" is not a valid command line switch for cmd.exe
Try "/C calc" or "/K calc"

--Robby
 
Garrett said:
Hi all, I am trying to run calc from the command line using a Process.
I am clearly missing something obvious here because the command line
opens but the "Calc" arg never executes...code below...thanks.



Module Module1

Sub Main()
Dim proc As New Process()
Dim info as ProcessStartInfo = new ProcessStartInfo("cmd.exe",
"calc")
proc.StartInfo = info
proc.EnableRaisingEvents = true
proc.Start()
proc.WaitForExit()
End Sub

End Module
Try
Dim info as ProcessStartInfo = new ProcessStartInfo("calc")
 
Try
Dim info as ProcessStartInfo = new ProcessStartInfo("calc.exe")
instead of "cmd.exe", "calc" and it will work just fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top