2011-09-09 65 views

回答

2

工作了

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"); 
    } 
}