通过运行补丁来替换Windows应用程序的exe [英] Replace exe of a windows application by running a patch

查看:75
本文介绍了通过运行补丁来替换Windows应用程序的exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在客户端(10台笔记本电脑)的PC中安装了Windows应用程序.我们不知道那里的安装路径,但是现在我们在应用程序中进行了一些更改.现在需要通过运行补丁文件来更改客户端PC中的exe和dll文件.我们知道这些文件的名称,但不知道客户端PC的安装路径.请为我们提供c#代码以执行相同的操作...

解决方案

嗨 这就是您需要的:在C#中获取已安装的应用程序路径 [ ^ ]

private const string keyBase = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths";
private string GetPathForExe(string fileName)
{
    RegistryKey localMachine = Registry.LocalMachine;
    RegistryKey fileKey = localMachine.OpenSubKey(string.Format(@"{0}\{1}", keyBase, fileName));
    object result = null;
    if (fileKey != null)
    {
        result = fileKey.GetValue(string.Empty);
    }
    fileKey.Close();

    return (string)result;
}


像这样使用它:

字符串pathToExe = GetPathForExe(" );  pre> 
但是,很可能正是您想要的应用程序没有应用程序路径"键. ^ ]


希望对您有所帮助.


We have our windows application installed in client''s (10 laptops) pc''s. We don''t know the installation path there but now we have made some alterations in the application. Now need to change the exe and dll files in client pc''s by running a patch file. we know the names of these files but don''t know the installation path in client pc''s. kindly provide us the c# code to do the same...

解决方案

Hi This is what you need: Getting installed app path in C#[^]

Or

private const string keyBase = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths";
private string GetPathForExe(string fileName)
{
    RegistryKey localMachine = Registry.LocalMachine;
    RegistryKey fileKey = localMachine.OpenSubKey(string.Format(@"{0}\{1}", keyBase, fileName));
    object result = null;
    if (fileKey != null)
    {
        result = fileKey.GetValue(string.Empty);
    }
    fileKey.Close();

    return (string)result;
}


Use it like so:

string pathToExe = GetPathForExe("wmplayer.exe");


However, it may very well be that the application that you want does not have an App Paths key.Source[^]


I hope it''s helps.


这篇关于通过运行补丁来替换Windows应用程序的exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆