如何获取特定产品C#的所有应用程序的工作目录 [英] How to get working directory of all applications of a specific product C#

查看:68
本文介绍了如何获取特定产品C#的所有应用程序的工作目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我可以访问可能正在运行或可能未运行的应用程序的工作目录/配置文件.

我的要求是-我的机器上安装了特定产品的软件列表(例如:像excel,word,Microsoft产品的Outlook.).如果我在任何这些应用程序中更改主题,都应反映在同一产品的所有其他已安装软件中. (例如:如果我在excel中更改主题,则应该在字词,Outlook等中反映出来.)要仅更改主题,我必须编辑配置文件.

这怎么可能?

请向我提供解决方案或参考链接.

在此先感谢.

Hi All,

Ho can I access working directory/config file of an application, which may or may not be running.

My requirement is - I have list of softwares of specific product(for eg: like excel, word, outlook of Microsoft product.)installed in my machine. If I change the theme in any of these application should reflect in all other installed softwares of same product. (eg: If I change theme in excel, that should reflect in word, outlook etc.) To change the theme only I have to edit the config file.

How is this possible?

Please provide me a solution or a reference link.

Thanks in Advance.

推荐答案

首先,这不是工作目录.这是可执行文件目录.
工作目录取决于用户如何启动应用程序以及在运行应用程序时的进一步步骤. 用户可以在任何工作目录下启动任何应用程序.该应用程序永远不应对其进行任何假设.

您只能获得有关通过系统安装并在注册表中注册的文件的信息.方法如下:

首先,您需要访问每个已安装产品的所有文件路径名.使用此注册表项访问可执行文件列表:

First, this is not working directory. This is executable file directory.
Working directory depends on how the user starts application and further steps while running it. The user can start any application with any working directory. The application should never make any assumptions on it.

You can only get this information about the files installed through the system and registered in the registry. Here is how:

First, you need to access all the to the file path names for every installed product. Use this Registry key to access the list of executable files:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths



您可以使用类Microsoft.Win32.Registry访问注册表节点.

对于该节点的每个子节点,您将找到可执行文件的路径名.您也可以使用System.IO.Path.GetDirectoryName找到其目录路径.

—SA



You can access Registry nodes using the class Microsoft.Win32.Registry.

For every child node of this node you will find executable file path name. You can also find its directory path using System.IO.Path.GetDirectoryName.

—SA


这篇关于如何获取特定产品C#的所有应用程序的工作目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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