Problems executing external application (.exe) using Windows service

  • Thread starter Thread starter gaurav tyagi
  • Start date Start date
G

gaurav tyagi

hi mahesh
i am gaurav from bangalore
i have one problem ,can u please help me out.

i have one windows application and one windows service.
from windows application i have to call one process "gpg" to encrypt
my text file so i use
system.Diagnostics.process class to make new process.
my code is like this


Process processEncryption = new Process();
processEncryption.StartInfo.WorkingDirectory = @"c:\Gnu\GNUPg";
processEncryption.StartInfo.FileName = "gpg";
processEncryption.StartInfo.Arguments = @" -o " + "\"" + path +
fileName + "\"" + " --passphrase " + passphrase + " -d " + "\"" + path
+ fileName + ".gpg" + "\"";
processEncryption.Start();
processEncryption.WaitForExit();

this code work fine if i use this code in windows application
but it does not work at all in windows service .code runs comepletely
but does not produce any output "
it seems that this code is not able to start process "gpg" if we run in
windows service.
can u help me
thanx in advance
bye
 
services can not run windows apps (say like notepad.exe), only commandline
(xcopy.exe for example).

-- bruce (sqlwork.com)
 
Back
Top