Escape to the shell (command line application)

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi,

I am writing a command line application and I would like to implement a
functionality similar to the "!" command in ftp.exe (that comes with most
windows distros) so that I can leave my application running on the background
and return to the cmd prompt, then I can come back to my application by
typing "exit"

any ideas?

Cheers

JT.
 
I am writing a command line application and I would like to implement a
functionality similar to the "!" command in ftp.exe (that comes with most
windows distros) so that I can leave my application running on the background
and return to the cmd prompt, then I can come back to my application by
typing "exit"

any ideas?

Well, you'll need to write quite a lot of it yourself, but the Console
class provides a lot of the functionality you'll need.

Jon
 
Hi,

I am writing a command line application and I would like to implement a
functionality similar to the "!" command in ftp.exe (that comes with most
windows distros) so that I can leave my application running on the background
and return to the cmd prompt, then I can come back to my application by
typing "exit"

any ideas?

Cheers

JT.

I am not really sure if this would work but you try Process with Cmd
and you could redirect your standard in and out to the parent
application. Dont know if it is possible , just a direction you can
look at.
 
John said:
Hi,

I am writing a command line application and I would like to implement a
functionality similar to the "!" command in ftp.exe (that comes with most
windows distros) so that I can leave my application running on the
background
and return to the cmd prompt, then I can come back to my application by
typing "exit"

any ideas?

You should look at Windows PowerShell. I don't know what your command line
app does but, you really want to use PowerShell as the command framework.
Create Cmdlets that implement your application's commands, maybe even create
a PowerShell host specifically for your app.
 
John said:
I am writing a command line application and I would like to implement a
functionality similar to the "!" command in ftp.exe (that comes with most
windows distros) so that I can leave my application running on the background
and return to the cmd prompt, then I can come back to my application by
typing "exit"

Simple example:

using System;
using System.Runtime.InteropServices;

namespace E
{
public class Program
{
[DllImport("msvcrt.dll")]
public static extern int system(string cmd);
public static void Main(string[] args)
{
system("cmd");
Console.WriteLine("Done");
}
}
}

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top