Quantcast
Channel: Oracle Bloggers
Viewing all articles
Browse latest Browse all 19780

Windows: Powershell can show java process full command line

$
0
0

Doesn't java process tend to have many arguments?
I was running Java plug-in apps downloaded in Firefox and needed to know full command line today. So, I googled and learned that PowerShell can do it.

PS C:\> Get-WmiObject Win32_Process -Filter "name = 'java.exe'" |>> select CommandLine | Out-String -width 2000>>

CommandLine

-----------

"C:\Program Files (x86)\Java\jre1.7.0_65\bin\java.exe" -Dfile.encoding=UTF-8 -Xmx512m -cp .;XYZ...

But this has 2 problems.

  1. I don't run PowerShell open all the times. So, I want to make this a one-liner and want to invoke directly from Cygwin or other means.
  2. My java.exe full command line is about 2000 byte length! Copy & Paste from Powershell.exe inserts newlines at window width, like c-m-d.exe.

So, I tried many ways and this is the best I could achieve. Here's the command.

powershell -Command "&{Get-WmiObject Win32_Process -Filter \"name = 'java.exe'\" | select CommandLine|Out-String -width 2048}"|findstr java.exe|clip

And run this from Windows menu "Run" dialog. (Win+R).

Now the full command line is in copy&paste buffer as 1 line text.
I couldn't figure out a nice way to invoke from Cygwin bash.


Viewing all articles
Browse latest Browse all 19780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>