467,915 Members | 1,552 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

Escape to the shell (command line application)

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.
Jun 27 '08 #1
  • viewed: 1883
Share:
4 Replies
On Jun 17, 11:53 am, John <J...@discussions.microsoft.comwrote:
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
Jun 27 '08 #2
On Jun 17, 6:53 am, John <J...@discussions.microsoft.comwrote:
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.
Jun 27 '08 #3
"John" <Jo**@discussions.microsoft.comwrote in message
news:3E**********************************@microsof t.com...
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.

Jun 27 '08 #4
John wrote:
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
Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Paul Watson | last post: by
3 posts views Thread by Eli Criffield | last post: by
reply views Thread by Jon Skeet [C# MVP] | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.