How to output PID's into a text file from command line (Windows)
I have used various tools that output running processes on Windows, although none of them seem to allow you to export just开发者_StackOverflow中文版 the pids e.g. one PID on each line for each running process.
Is there a way of doing this from command line?
tasklist /FO CSV
gives you a csv list, just yank the 2nd column.
@echo off
for /f "tokens=2 delims=," %%i in ('tasklist /FO CSV') do (
echo %%i
)
Call this .bat > mytextfile.txt
for xp, vista, windows 7 you can use tasklist at the command promt
精彩评论