0

I have an application on Windows 10 VPS that I will be only able to have access via the command prompt. After the application is ran, I want it to be able to retrieve input from the command prompt, and give back output. Although, after disconnecting the application should still run in the background.

When I reconnect to the VPS, I want to regain the ability to input and output text through the command prompt, without restarting the application.

4
  • I think you may be going about this the wrong way. Can you explain a little about what you are trying to do with this? I think you you should just make a WPF or WinForm application and collapse it to the System tray Commented Mar 4, 2017 at 2:46
  • @XanderLuciano I've edited the post to be a bit more specific as to what I'm trying to do. Commented Mar 4, 2017 at 2:55
  • Ah gotcha, so then you'd wanna have a Windows service running on your VPS that is your application. Then you when you log in to your VPS you would start your "interface" which talks to the windows service. This is because I do not know of any way to keep a console from closing, the service will not close though. You would then want to send data back and forth over WCF or maybe a named pipe/socket Commented Mar 4, 2017 at 3:00
  • I'll definitely try this out. Thanks! Commented Mar 4, 2017 at 3:05

1 Answer 1

1

Here's some documentation example code of how to create a TCP client in C# if you decide to go the TCP/Sockets route over WCF: http://www.winsocketdotnetworkprogramming.com/clientserversocketnetworkcommunication8q.html

And here's the MSDN page on WCF: https://msdn.microsoft.com/en-us/library/ms731082(v=vs.110).aspx

This is the MSDN page on creating a service application: https://msdn.microsoft.com/en-us/library/zt39148a(v=vs.110).aspx

Do note: "The Windows Services project template that is required for this walkthrough is not available in the Express edition of Visual Studio."

But don't let that concern you. All this means is that your program would not be able to register as a windows service, and therefore could not truly operate like a service which can start on boot, pause, stop restart, etc. Howerver, this doesn't stop you from creating a program that automatically starts. You could simply place a shortcut to your program in your startup folder:

C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Hopefully that helps get you started in the right direction!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.