Cannot start bat file from service RRS feed

  • Вопрос

  • I need to start bat-file from windows service. When I start bat file from cmd or my other application (for example console or winforms) its works normally. But when I put the same code inside service class - it hang!
    public partial class CoreService : ServiceBase
            private const string aplToStart = "cmd.exe";
            private const string pathToStartup = @"/c startup.bat";
            private const string workingDirectory = @"C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.18\bin\";
            private Process process;
            public CoreService()
            protected override void OnStart(string[] args)
                var info = new ProcessStartInfo
                                   FileName = "cmd.exe",
                                   UseShellExecute = false,
                                   Arguments = pathToStartup,
                                   WorkingDirectory = workingDirectory,
                                   RedirectStandardOutput = true
                process = new Process {StartInfo = info};
            protected override void OnStop()
    Please give any ideas about this!
    • Перемещено Siddharth Chavan 1 октября 2010 г. 19:51 MSDN Forums Consolidation (От:Общая Архитектура)
    5 августа 2009 г. 12:35


Все ответы