Labels: Use Io art ar Div line to manage windows
There is a C # command line console program. In order to see the output of the console, it cannot be used as a service. To prevent these programs from dying, use the powershell monitoring program and restart it.
# Use the program name to restart
If (! (Get-process | where-object {$ _. mainwindowtitle-EQ 'administrator: "tsiphone "'}))
{Cd c: \ lengshan
C: \ lengshan \ tsiphone. Bat}
# If it is executed in the command line parameter, it should be adapted to gwmic to obtain the comandline content for distinction # Because under normal circumstances, the get-process operation does not have the comandline attribute.
If (! (Get-wmiobject win32_process | where {$ _. commandLine-EQ "'" C: \ PHP \ php.exe' "'" C: \ Program Files (x86) \ Apache Software Foundation \ apache2.2 \ htdocs \ deamon \ igetui_deamon.php '""}))
{CMD/C start "" C: \ lengshan \ tsgetui. Bat "}
# Make the command line BAT, and then use powershell to determine whether the process exists. If it does not exist, end the corresponding cmd process first, and then use start to open a new cmd window to start the PHP process.
If (! (Get-wmiobject win32_process | where {$ _. commandLine-EQ "'" C: \ PHP \ php.exe' "'" C: \ Program Files (x86) \ Apache Software Foundation \ apache2.2 \ htdocs \ deamon \ apns_deamon.php '""}))
{Get-process cmd | where {$ _. mainwindowtitle-EQ "Administrator: '" tsiphone' "} | stop-Process
CMD/C start "" C: \ lengshan \ tsiphone. Bat "}