0

I'd like to create a front end for a command window session in VB.NET. The key I think is, I need it to be persistent; meaning, I know how to send single command lines using System or Process.Start, and even collect the feedback, but I need the command window session to stay alive for a possible sequence of commands. for example, a series of commands would change the folder to a specific folder, then scan and present the folder contents, and then allow the user to copy a specified set. This requires the cmd session to stay "alive" in the background with an active state.

There must be a relatively simple way to do this, can someone provide some pointers? Thank you.

(I've been directed to explain how this question differs from other questions. The suggested duplicate does not persist the session, just issues commands and prints the output.)

Chris
  • 629
  • 1
  • 10
  • 28
  • all those example actions can be done with c# api...there is k switch for cmd... And why it has c# tag? – Selvin May 18 '23 at 23:17
  • The following may be of interest: https://stackoverflow.com/a/51682585/10024425 – Tu deschizi eu inchid May 18 '23 at 23:36
  • @Selvin, the C# and VB.NET frameworks are nearly identical, so I thought I'd ask those experts too. I know about the /k switch, but not sure how to send that to a persistent session, rather than using Process.start or Shell. Any specific suggestions? – Chris May 18 '23 at 23:47
  • @Tu, I've used that approach, it lets you get the output, but I don't think it persists; i.e., you cant send a sequence of commands like you could to an active cmd window (with state such as current directory being persisted) – Chris May 18 '23 at 23:49
  • 1
    Read the notes (and the comments in code) here: [How do I get output from a command to appear in a control on a Form in real-time?](https://stackoverflow.com/a/51682585/7444103) -- There's also a test Project you can download – Jimi May 19 '23 at 00:23
  • Why not just use PowerShell ISE ? – SSS May 19 '23 at 04:46

0 Answers0