程序代码 Private Sub Command1_Click() Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\.\root\cimv2") Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process") For Each objprocess In colProcesses If objprocess.Name = Text1 Then Text2 = objprocess.ExecutablePath 'text1为进程名(注意区分进程名大小写),objprocess.ExecutablePath等于进程路径 End If Next End Sub '-------------------------------------根据进程名取进程路径
已有评论: