This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CYGWIN_NT-5.1 1.7.0(0.214/5/3) ps (cygwin) 1.11 - how do I display the arguments to the processes?

Chris January <> writes:
> Install the procps package and then use the procps command.

You can also try WMIC which comes with Windows, on XP in my case.

If you need for e.g., PID/PPID/CMDLINE, especially if you need see
Windows native processes and if procps can't do that (I don't know if it
can or not), then you can use this script:


## here, "</dev/null" needed because wmic.exe get confused if STDIN is a pipe 

$Processes=`wmic.exe path win32_process get CommandLine,ProcessId,ParentProcessId </dev/null`;
@Processes = split /\r*\n/, $Processes;

$Processes[0] =~ m/^(CommandLine.*)(ParentProcessId.*)(ProcessId.*)$/ or #the order of pid/ppid seems to be random with wmic?
    die "can't match the first line";

printf "%9s%9s  %s\n", PID, PPID, COMMAND;
foreach (@Processes[1..$#Processes]) {
    m/^(.*?)\s*([0-9]+)\s*([0-9]+)\s*$/ or die "can't match $_";
    printf "%9d%9d  %s\n", $3, $2, $1;

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]