gpt4 book ai didi

.net - 如何从远程机器获取 CommonApplicationData?

转载 作者:可可西里 更新时间:2023-11-01 10:28:16 25 4
gpt4 key购买 nike

我想获取远程机器上“CommonApplicationData”的路径。

这是本地版本

Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)

但我如何远程执行此操作?也许有一些 WMI?

最佳答案

解决了

public static string GetCommonAppData(string machineName)
{
var shellFoldersPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders";
using (var remoteBaseKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, machineName))
using (var shellFolders = remoteBaseKey.OpenSubKey(shellFoldersPath))
{
return (string) shellFolders.GetValue("Common AppData");
}
}

关于.net - 如何从远程机器获取 CommonApplicationData?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7356112/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com