2012-04-15 3 views

답변

2

디스크에 먼저 저장하지 않고 .cmd 또는 .bat 파일을 실행할 방법이 없습니다. 읽기 및 해석을 위해서는 cmd.exe이어야합니다. 먼저 디스크에 저장하고 거기에서 실행해야합니다.

저장하면 System.Diagnostics.Process을 사용하여 실행할 수 있습니다. 링크의 VB.Net 예 :

Imports System 
Imports System.Diagnostics 
Imports System.ComponentModel 

Namespace MyProcessSample 
Class MyProcess 

    Public Shared Sub Main() 
    Dim myProcess As New Process() 

     Try    ' Get the path that stores user documents. 
     myProcess.StartInfo.UseShellExecute = False 
     ' You can start any process, HelloWorld is a do-nothing example. 
     myProcess.StartInfo.FileName = "C:\\HelloWorld.exe" 
     myProcess.StartInfo.CreateNoWindow = True 
     myProcess.Start() 
     ' This code assumes the process you are starting will terminate itself. 
     ' Given that is is started without a window so you cannot terminate it 
     ' on the desktop, it must terminate itself or you can do it 
     ' programmatically from this application using the Kill method. 
     Catch e As Exception 
     Console.WriteLine((e.Message)) 
     End Try 
    End Sub 'Main 
    End Class 
End Namespace 
+0

감사합니다. 나는 이것이 할 괜찮다고 생각합니다. –

관련 문제