c# - 从基于 Is64Bit bool 的路径中获取 FileInfo
问题描述
所以我有一个string Path
代表文件路径的文件,C:\Windows\System32\cmd.exe
例如。
我的应用程序设置为 Any CPU 并且不会改变,但是给定一个bool Is64Bit
标志,我怎样才能有一个返回以下内容的方法:
// On 64 bit OS
GetFileInfo("C:\\Windows\\System32\\cmd.exe", Is64Bit: true); // return C:\Windows\System32\cmd.exe
GetFileInfo("C:\\Windows\\System32\\cmd.exe", false); // return C:\Windows\Syswow64\cmd.exe
GetFileInfo("C:\\Program Files\\file.txt", true); // return C:\Program Files\file.txt
GetFileInfo("C:\\Program Files\\file.txt", false); // return C:\Program Files (x86)\file.txt
// On 32 bit OS
GetFileInfo("C:\\Windows\\System32\\cmd.exe", true); // return C:\Windows\System32\cmd.exe
GetFileInfo("C:\\Windows\\System32\\cmd.exe", false); // return C:\Windows\System32\cmd.exe
GetFileInfo("C:\\Program Files\\file.txt", true); // return C:\Program Files\file.txt
GetFileInfo("C:\\Program Files\\file.txt", false); // return C:\Program Files\file.txt
换句话说,有没有办法强制将路径从 64 位应用程序重定向到其 32 位对应项?
解决方案
推荐阅读
- java - 重新发布 kafka DLQ 主题
- opencv - 在 OpenCV 中,将图像加载为灰度图像并在将其加载为彩色图像后将其转换为灰度之间的时间成本差异
- python - 为 gensim 模型引发 KeyError("word '%s' not in words" % word)
- linux-kernel - 有没有办法从 linux 设备驱动程序中的探测功能中删除加载的模块?
- javascript - 如何使用嵌入式框架修复页面布局
- c# - 使用 group by 将 c# 列表转换为 json
- python - 使用移动机器人框架无法进入框架
- java - 如何在不重定向到 Okta 登录的情况下使用 Okta 对用户进行身份验证
- python - 如何实现虚拟键盘
- javascript - 如何使用 javascript 挤压 svg 形状