Bonjour à tous,
je suis en train de créer un windows service qui doit exécuter un .bat.
Ce .bat est installé sur le poste en même temps que le service windows.
J'utilise un Installer et installe mon service via un MSI.
Durant l'intallation je spécifie le répertoire d'installation (où est entre autre installé le .bat)
ma question ...j'y arrive enfin !!
Comment récupérer le chemin du répertoire d'installation pour le passer en paramètre au service windows ?
merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 public partial class MonService : ServiceBase { public MonService() { InitializeComponent(); } protected override void OnStart(string[] args) { evLgTracer.WriteEntry("MonSevice started."); string monCheminVersMonFichierBat = ???; ProcessStartInfo processInfo = new ProcessStartInfo(monCheminVersMonFichierBat + @"/info.bat"); Process monProcess = Process.Start(processInfo); monProcess.WaitForExit(); } protected override void OnStop() { evLgTracer.WriteEntry("MonSevice stopped."); } }![]()
Partager