472,965 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,965 software developers and data experts.

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
4 2079
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Paul Watson | last post by:
How can I get the escapes from a command line parameter interpreted? The user provides a string on the command line. The string might contain traditional escapes such as \t, \n, etc. It might...
8
by: Joe | last post by:
I'm using Python 2.4 on Windows XP SP2. I'm trying to receive a command line argument that is a newline (\n) Here is the command line to use sample.py "\n" Here is a sample.py script
4
by: Kartik | last post by:
Hi, I have an ASP.NET application using VB.NET.I am sending a DOS command to a machine on the network to print a file. This is achieved using xp_cmdshell Dim str As String = "xp_cmdshell...
3
by: Eli Criffield | last post by:
I'm try run an ssh command in pexpect and I'm having trouble getting everything escaped to do what i want. Here's a striped down script showing what i want to do. -- #!/usr/bin/env python...
9
by: Tommy Lu | last post by:
Hi, wondering if there is a way to interact the shell command with the C# program? For example, if I type c:\>ver it then suppose to return the version of the OS I am currently using... or ...
3
by: David Eadie | last post by:
G'Day all, I cant for the God in me work out how to execute the following command line in vb.net: (watch for the word wrapping also) Sub(ByVal username As String) Shell("ECHO Y| cacls...
7
by: Bin Chen | last post by:
Hi, I want to do following: get a user input regex, then pass this as a parameter to grep, and then get the result from grep. Any code snip to implement the similar function? I am a python...
3
by: ppuniversal | last post by:
Hi everyone, I am making using Shell() function to run a command line tool from my VB Application. I am using it to archive a folder. So I am using the code : Shell("command line argument as...
0
by: Jon Skeet [C# MVP] | last post by:
On Jun 17, 12:02 pm, "Jon Skeet " <sk...@pobox.comwrote: Sorry, ignore this answer - it's completely brain dead; I'd misunderstood the question. I don't know a way of launching an command shell...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.