Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel宏检查后台电源外壳脚本_Excel_Vba - Fatal编程技术网

Excel宏检查后台电源外壳脚本

Excel宏检查后台电源外壳脚本,excel,vba,Excel,Vba,你能帮我写一个excel宏来检查;计算机中是否正在运行后台Power Shell脚本 谢谢, 阿内什 ()通常人们会发布他们已经编写和尝试过的代码。请阅读 Sub IsPowerShellRunning() Debug.Print IsProcessRunning("powershell.exe") End Sub Function IsProcessRunning(process As String) as Boolean Dim objList As Object

你能帮我写一个excel宏来检查;计算机中是否正在运行后台Power Shell脚本

谢谢, 阿内什


()

通常人们会发布他们已经编写和尝试过的代码。请阅读
Sub IsPowerShellRunning()
    Debug.Print IsProcessRunning("powershell.exe")
End Sub

Function IsProcessRunning(process As String) as Boolean
    Dim objList As Object

    Set objList = GetObject("winmgmts:") _
        .ExecQuery("select * from win32_process where name='" & process & "'")
    If objList.Count > 0 Then
        IsProcessRunning = True
    Else
        IsProcessRunning = False
    End If

End Function