question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get-Process $pid should suggest using -Id $pid

See original GitHub issue

The default parameter set for Get-Process accepts -Name by position.

Maybe it’s just me, but I forget this all the time, and expect Get-Process 1234 to work.

I think we can make it work in a reasonable way too. If Name is a positive integer and we do not find a process by that name, search again assuming it was a ProcessId.

Edit: instead of making this work (which might not be a good idea always) - I like the suggestion from @rkeithhill to give a better error message.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:24 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
rkeithhillcommented, Dec 9, 2016

Agreed. At the very least, the error message could say Cannont find a process with the name "1234". If 1234 is a process Id, use Get-Process -Id 1234. Of course, you would only use that error message when the Name parameter value is all digits.

2reactions
KirkMunrocommented, Nov 24, 2016

Just to add to this, where this particular issue drives me the most is that Stop-Process uses a default parameter set that requires Id rather than name. I always try something like this first:

spps *edge*

Then I sigh, then I re-run the command, explicitly using the -Name parameter.

I would much prefer if this set of commands simply had a consistent rule among them that made ad-hoc use more palatable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get-Process (Microsoft.PowerShell.Management)
Specifies one or more processes by process ID (PID). To specify multiple IDs, use commas to separate the IDs. To find the PID...
Read more >
How to Find Process ID (PID and PPID) in Linux
Learn how to find PID using a process name in Linux. ... If you know the exact process name, you can get its...
Read more >
Get a process ID - linux
Get a process ID · I have to filter my output using grep commands. Examples: ps -ef | grep user | grep info1...
Read more >
How to Find Process Name from its PID
You can list all running process using the ps command or top command and note the process ID and process name as desired....
Read more >
Run a process to particular/dedicated pid only
I have a c program executable or shell script which I want to run very often. If I want to stop/pause or to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found