c# - Monitoring completed status of a remote cmd.exe process -
i running .bat file in computer computer b using form application using wmi publish dash boards. .bat file calls command line utility tabcmd.exe multiple times , utility updates log file in computer in below location "c:\users[username]\appdata\roaming\tableau\tabcmd.log"
i want update form application log file details in computer b once process completed in computer a. running .bat file using below,
string path = @"c:\tabcmd.bat"; string machinename = textbox1.text; var processtorun = new[] { path }; var connection = new connectionoptions(); connection.username = textbox3.text; connection.password = textbox2.text; var wmiscope = new managementscope(string.format("\\\\{0}\\root\\cimv2", machinename), connection); var wmiprocess = new managementclass(wmiscope, new managementpath("win32_process"), new objectgetoptions()); wmiprocess.invokemethod("create", processtorun); this .bat file publishes dashboards in computer b based on dynamic datasource parameters, run-time of .bat file unpredictable, in case how ensure .bat file run or updating log file completed.
is there way monitor process process id? if can read log file once process completed. below not helping me in situation since cmd.exe still running in target computer a.
system.diagnostics.process prc = system.diagnostics.process.getprocessbyid(10100, "chorrl0110") prc.waitforexit () thanks help!
Comments
Post a Comment