是否可以使用VB.NET获取程序名称? [英] Is it possible to get Program Name using VB.NET?
问题描述
大家好,
我不知道是否可以这样做,这是我的要求:
- 我运行了Ms.Access,Ms.Word,Firefox,Crystal Report和其他程序(总共:我的电脑中的7个程序)
- 我想要捕获程序名称,例如:Ms.Access,Ms .Word,Firefox,Crystal Report和其他程序名称到一个文件(文本文件)。
是否可以使用vb.net?
谢谢
TONY
Hi all experts,
I don't know it is possible to do this or not and this is my require:
- I run Ms.Access, Ms.Word, Firefox, Crystal Report and other program (total: 7 Programs in my PC)
- I want to capture program name such as: Ms.Access,Ms.Word,Firefox, Crystal Report and other Program Name to one file (text file).
Is it possible to capture those program name using vb.net?
Thanks
TONY
推荐答案
Do类似的东西..
Do something like..
For Each p As Process In Process.GetProcesses()
Console.WriteLine(p.ProcessName)
Next
然后写入文本文件,例如:
http: //www.homeandlearn.co.uk/NET/nets8p4.html [ ^ ]
http:// msdn .microsoft.com / zh-CN / library / 6ka1wd3w.aspx [ ^ ]
是的,它是可能的。尝试例如这个:
Yes, it is possible. Try e.g. this:
Dim psList() As Process
Try
psList = Process.GetProcesses()
For Each p As Process In psList
Console.WriteLine(p.Id.ToString() + " " + p.ProcessName)
Next p
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
Console.ReadKey()
这篇关于是否可以使用VB.NET获取程序名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!