When starting a process in VB.Net, I would like to give it a custom name that can be accessed by any function I give this process to as a argument.
I launch my process this way :
Dim mainProcessHandler As New ProcessStartInfo()
Dim mainProcess As Process
mainProcessHandler.FileName = "something_01out18.bat"
mainProcessHandler.Arguments = "-d"
mainProcessHandler.WindowStyle = ProcessWindowStyle.Hidden
mainProcess = Process.Start(mainProcessHandler)
If I do nothing more, when using
mainProcess.ProcessName
I will get "cmd" as it's a bat script run by cmd.
Can I do something like
mainProcess.myCustomName = "bat01out18"
And call it in a function
Sub doThingsWithProcess(ByVal usedForThingsProcess As Process) As Boolean
infoConsoleDisplay("process " + usedForThingsProcess.myCustomName + " will be used to for things")
End Sub
I'm pretty sure there is a way to achieve such thing but maybe with a different approach. Do you have any idea ?