【问题标题】:PHP - Get File Name of Running Script from Windows Processes?PHP - 从 Windows 进程获取运行脚本的文件名?
【发布时间】:2014-12-22 22:32:54
【问题描述】:

我正在运行三个 PHP 进程。其中一个进程正在运行script_one.php,另外两个正在运行script_two.php。当我在命令行中使用Get-Process 时,所有三个进程都将“php”列为进程名称。

有没有办法区分不同的脚本?

【问题讨论】:

    标签: powershell process cmd windows-server-2008


    【解决方案1】:

    试试这个:

    Get-WmiObject -Class win32_process -Filter "Name = 'php.exe'" |
     Where {$_.CommandLine -match 'my_script\.php'}
    

    【讨论】:

    • 我收到 Invalid query "select * from win32_process where ProcessName = 'php.exe'" 错误
    • 你运行的是什么PS版本?
    • 在取出ProcessID 后能够使其工作。如果我想添加第二个过滤器,在CommandLine 中查找my_script.php,我该怎么做?
    猜你喜欢
    • 2012-08-14
    • 1970-01-01
    • 1970-01-01
    • 2020-08-19
    • 1970-01-01
    • 1970-01-01
    • 2010-10-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多