开始新的过程,而不产卵过程中的一个子 [英] Start new process, without being a child of the spawning process
本文介绍了开始新的过程,而不产卵过程中的一个子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么会去开始没有它调用进程的孩子一个新的进程。
How would I go about starting a new process without it being the child of the calling process.
例如:
主程序(Caller.exe)
process.start("file.exe")
推荐答案
下面就是我现在使用的代码。我认为这可能是有用的人。它接受一个参数。该参数是一个64位编码解码到您想运行的文件的路径。
Here is the code that I'm now using. I thought that it may be useful to someone. It accepts one argument. The argument is a base64 encoded string that decodes to the path of the file that you would like to run.
Module Module1
Sub Main()
Dim CommandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Application.CommandLineArgs
If CommandLineArgs.Count = 1 Then
Try
Dim path As String = FromBase64(CommandLineArgs(0))
Diagnostics.Process.Start(path)
Catch
End Try
End
End If
End Sub
Function FromBase64(ByVal base64 As String) As String
Dim b As Byte() = Convert.FromBase64String(base64)
Return System.Text.Encoding.UTF8.GetString(b)
End Function
End Module
这篇关于开始新的过程,而不产卵过程中的一个子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文