Skip to content

Instantly share code, notes, and snippets.

@book000
Created October 18, 2021 17:32
Show Gist options
  • Save book000/af5952d6b1369ea34829f613feef24d3 to your computer and use it in GitHub Desktop.
Save book000/af5952d6b1369ea34829f613feef24d3 to your computer and use it in GitHub Desktop.
Check if any of the specific applications are running in windows php
<?php
$check_working_applications = [
"vrmonitor.exe",
];
exec("tasklist /FO CSV 2>NUL", $task_list);
$task_list = array_map(function ($task) {
return str_getcsv($task, ",", '"');
}, $task_list);
foreach ($check_working_applications as $app) {
if (!in_array($app, array_column($task_list, 0))) {
continue;
}
echo "Application: " . $app . " is running.\n";
exit(2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment