I would like to get the results from executing "query session" in the cmd.exe and Store them in a string variable using VB.NET. I have been searching for two days now and I cannot get to run the command, I will try to save the result once I get the command running.
It seems that VisualStudio executes cmd.exe but not the one in C:\Windows\System32.
Dim process As System.Diagnostics.Process = New System.Diagnostics.Process process.StartInfo.FileName = "C:\Windows\system32\cmd.exe" process.StartInfo.Arguments = "/K query session" process.StartInfo.UseShellExecute = True process.StartInfo.CreateNoWindow = True process.StartInfo.RedirectStandardOutput = False process.Start() process.WaitForExit()
It returns error: 'query' is not recognized as an internal or external command, operable program or batch file.