This is the command line I want to use inside my VB.NET program. Look for the running process “mpc-hc.exe” and get the commandline of the running process
wmic process where name='mpc-hc.exe' get CommandLine
I want to retrieve the output from that command into a string. I know that it could be done natively in a VB.NET program and I have looked at how it was done. However, I cannot get the code to perform what it did in the commandline I have above.
Any suggestions on how should I implement this? Thanks.
wmicis a command-line wrapper for Windows Management Instrumentation (WMI) API. In .NET Framework, theSystem.Managementnamespace provides access to this API.The Visual Basic .NET equivalent of your command line is below. This code queries the
Win32_Processclass instances corresponding to mpc-hc.exe and reads theirCommandLineproperty: