I need to troubleshoot some issues on a client PC that I am unable to install additional software on and need some basic functionality of awk
on windows xp & 7.
Basically, I need to strip the process ID from netstat
so I can use it down the line in different parts of a script but have no knowledge of a native command that could do the equivalent of awk '{ print $4 }'
. Are there any options for me? Obviously I'm quite new to windows cli.
Best Answer
To get the Process ID (PID):
tasklist /fi "imagename eq netstat.exe" > D:\test.txt
That command will create a new text file with the process ID of netstat (if netstat is running).
The problem is, that this file will contain more than only the PID.
Maybe its enough for you to start with?