Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 347725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:17:51+00:00 2026-05-12T11:17:51+00:00

I have a windows service, written in c# and I need to run a

  • 0

I have a windows service, written in c# and I need to run a console application from it.
Console application also written in c#.

Console application is running fine when it is run not from windows service. When it is ran from ws it doesn`t do anything it should and as it should work for 10-20 seconds I see in debug code is executed at once.

I`m starting my console app with the following code:

proc.Start(fullPathToConsole, args);
proc.WaitForExit();

the path to console is right and when I`m trying to run it from the cmd or just in explorer (without args) it works fine. But after running with the service I see no effect.

I already tried to go to service properties and give it access to desktop and run under both system and my user (also specified in service properties). All remains the same.

ADDITION: I know service do not have ui and I don’t want one. I want service to run console application. No need to get any data from it or use this console like ui, just run it to do it`s job.

UPDATE I: discovered, that running calc or any other windows app is easy. But still can`t run cmd or any console app. Actually I need to run it on XP SP2 and Windows 2003 Server. So do not need to interact with Vista in anyway.

Would be glad to any comments!

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:17:51+00:00Added an answer on May 12, 2026 at 11:17 am

    Starting from Windows Vista, a service cannot interact with the desktop. You will not be able to see any windows or console windows that are started from a service. See this MSDN forum thread.

    On other OS, there is an option that is available in the service option called “Allow Service to interact with desktop”. Technically, you should program for the future and should follow the Vista guideline even if you don’t use it on Vista.

    If you still want to run an application that never interact with the desktop, try specifying the process to not use the shell.

    ProcessStartInfo info = new ProcessStartInfo(@"c:\myprogram.exe");
    info.UseShellExecute = false;
    info.RedirectStandardError = true;
    info.RedirectStandardInput = true;
    info.RedirectStandardOutput = true;
    info.CreateNoWindow = true;
    info.ErrorDialog = false;
    info.WindowStyle = ProcessWindowStyle.Hidden;
    
    Process process = Process.Start(info);
    

    See if this does the trick.

    First you inform Windows that the program won’t use the shell (which is inaccessible in Vista to service).

    Secondly, you redirect all consoles interaction to internal stream (see process.StandardInput and process.StandardOutput.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a C# Windows Forms application, not a service (it is only
I have written a Windows service to collect information from all of our SQL
I'm running a windows service (written using .NET) as the user - LocalSystem. From
I have got a windows service written in .NET and I need to be
I have several smart devices that run Windows CE5 with our application written in
I have a application written in C#, installed as a [WCF] windows service, which
I have a C# application that uses a Windows service that is not always
I have a Windows Service written in C# (.Net 3.5) and I need to
I have a custom windows service written in c# that I need to install
I have written a Windows service that allows me to remotely run and stop

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.