开发者

How to output PID's into a text file from command line (Windows)

开发者 https://www.devze.com 2023-03-03 21:13 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消