I looking for a way to run a command the requires "Last Logon" and use this command within the bounds of the "" that run the command as a string,
I will explain,
Main Body Of code,
Dim myProcess As New Process() myProcess.StartInfo.UseShellExecute = False myProcess.StartInfo.RedirectStandardOutput = True Try myProcess.StartInfo.FileName = "net" myProcess.StartInfo.Arguments = "user " & Environment.UserName & " | findstr /B /C:"last logon" myProcess.StartInfo.CreateNoWindow = True myProcess.Start() Label1.Text = _ Replace(myProcess.StandardOutput.ReadToEnd(), _ Chr(13) & Chr(13), Chr(13)) myProcess.WaitForExit() Catch ex As Win32Exception MsgBox((ex.Message + ". Error Detected.")) End Try
in the command prompt you can use a command that is as follows to retrieve user last logon
net user val | findstr /B /C:"Last logon"
Val would be replaced with the users username and will display this as last logon plus the time the objective of this is to display the information what would be in the command line in a label but I don't know how to double quote if you like because you already have to use "" in order for the text to be allowed.
any help will be much appreciated.
also this command works without errors the label will just disappear.