0
내 리소스에있는 cmd 파일로 배치 파일을 실행하려고합니다. 나는 그들을 어디에서라도 추출하려고 노력하지 않고있다. 나는 단순히 형식의 bat 명령을 편집하고 내가 갖고있는 cmd 파일로 실행하려고합니다. 이것이 가능한가?어떻게 vb 리소스에서 bat 파일과 사용자 지정 cmd 파일을 실행합니까?
내 리소스에있는 cmd 파일로 배치 파일을 실행하려고합니다. 나는 그들을 어디에서라도 추출하려고 노력하지 않고있다. 나는 단순히 형식의 bat 명령을 편집하고 내가 갖고있는 cmd 파일로 실행하려고합니다. 이것이 가능한가?어떻게 vb 리소스에서 bat 파일과 사용자 지정 cmd 파일을 실행합니까?
디스크에 먼저 저장하지 않고 .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
감사합니다. 나는 이것이 할 괜찮다고 생각합니다. –