Why do some processes from wmic process get name, commandline, processid, executablePath
not display a value for ExecutablePath
?
But I can find it in taskmanager ?
Is there any way to get executable path from wmic ?
Thank you all, especially to @Eryk Sun, here is my quite simple solution for others who will contend with same problem.
import com.sun.jna.platform;
String getExPath(int pid) {
Kernel32 kernel32 = Kernel32.INSTANCE;
WinNT.HANDLE hProcess = kernel32.OpenProcess(WinNT.PROCESS_QUERY_LIMITED_INFORMATION, false, pid);
char buffer[] = new char[1024];
IntByReference size = new IntByReference(buffer.length);
kernel32.QueryFullProcessImageName(hProcess, 0, buffer, size);
return new String(buffer).trim();
}
I was looking for similar method for obtain a commandline of process but i was not sucessfull. I appreciate an advice.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.