Although the solution may be implemented bypassing sending input to a cmd window, here is an example how to send the command to cmd and get back some output back:
Dim oShell, oExec
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.exec("%comspec%")
oExec.StdIn.Write "dir" & vbCrLf
oExec.StdIn.Write "cd c:\" & vbCrLf
oExec.StdIn.Write "dir" & vbCrLf
oExec.StdIn.Write "exit" & vbCrLf
ShowInNotepad oExec.StdOut.readall
Sub ShowInNotepad(strTest)
Dim TempPath
With CreateObject("Scripting.FileSystemObject")
TempPath = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%TEMP%") & "\" & .GetTempName
With .CreateTextFile(TempPath, True, True)
.WriteLine(strTest)
.Close
End With
CreateObject("WScript.Shell").Run "notepad.exe " & TempPath, 1, True
.DeleteFile(TempPath)
End With
End Sub