
本文介绍了如何在C#中获取64位进程的可执行路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从64位应用程序获取进程的可执行路径.使用以下代码仅适用于32位应用程序,但会在64位应用程序上引发错误.
Process proc = Process.GetProcessById(( int )pid);
返回 proc.MainModule.FileName;
是否有办法在64位应用程序上获取可执行文件的完整路径? >解决方案
Get a process''s executable path from a 64-bit application. Using the following code only works for 32-bit applications but throws an error on 64-bit apps.
Process proc = Process.GetProcessById((int)pid);
return proc.MainModule.FileName;
Is there a way to get the full path to the executable file on 64-bit applications?
解决方案
这篇关于如何在C#中获取64位进程的可执行路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!