我正在从用 C 编写的程序运行 tasklist 命令,问题是我需要程序返回屏幕,只是“图像名称”列省略了其他列。有什么方法可以过滤它,只留下名称进程而不是 PID 列或其他?
这是我的代码:
#include <stdio.h>
#include <string.h>
int main(){
printf("IP number:\t");
scanf("%s", ip);
sprintf(command, "tasklist /fo TABLE /nh /s %s", ip);
system(command);
return 0;
}