开发者

Win7, need to see detailed command line information for running java.exe processes

开发者 https://www.devze.com 2023-03-15 22:12 出处:网络
[Please read all of this content - I realize this very question has been asked on SO but no prior answers work for me.]

[Please read all of this content - I realize this very question has been asked on SO but no prior answers work for me.]

On Win7, for any java.exe process that's running, I need to see the exact command line that was issued to launch the process. I already realize Task Manager does this with the 'Command Line' column, but if the command line is very long, it eventually truncates the text in the display and I cannot see 开发者_如何学运维everything I need.

I know this has been asked before and I have already tried SysInternals Process Explorer but it does not show anything for the command line for any of my java.exe processes, unlike how many other StackOverflows answers have described. I have also tried JVisualVM and jps, but from what I can tell, these require a JMX or jstatd connection, which I don't think apply in my case (please correct me if I'm wrong). I have even gone as far as creating a DMP file from Task Manager and investigating it, but this, in addition to being overkill, did not provide me what I needed.


Ok I'll just assume that you won't need a Java solution, so here we go. I remembered reading about that at Raymond Chens great blog some time ago (did I really remeber a 1 1/2 yr old blog post of a guy that posts 3+ posts a week? alarming~)

So here we go, I think his warning doesn't even matter for java programs since you only get strings which means that a) they were already copied and b) you can't access the raw data and therefore change it (note: pure speculation).

Something along this lines should work (probably use ExecutionPath instead of name, you should be able to figure the right thing out for you):

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Process where Name='javaw.exe'")
For Each objItem in colItems
     Wscript.Echo objItem.Name
     Wscript.Echo objItem.CommandLine
Next
0

精彩评论

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