在 R 中访问 Windows 注册表 [英] Access Windows Registry inside R

查看:63
本文介绍了在 R 中访问 Windows 注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何访问R里面的windows注册表,比如我想访问文件夹:

How can I access the windows registry inside R. For example, I want to access the folder:

[HKEY_LOCAL_MACHINE\SOFTWARE\R-core\R\3.0.2]

和名为InstallPath"的密钥

and the key called "InstallPath"

获得:

"C:\\Program Files\\R\\R-3.0.2"

非常感谢!

推荐答案

您可以使用 readRegistry().

在我的机器上:

fp <- file.path("SOFTWARE", "R-core", "R", "3.1.0", fsep="\\")
readRegistry(fp, "HLM")  ## "HLM" eventually resolves to "HKEY_LOCAL_MACHINE"
# $InstallPath
# [1] "C:\\R\\R-current"

(另外,为了将来参考,在这种情况下,您可能已经通过快速调用 apropos("registry") 甚至 apropos("reg").)

(Also, for future reference, in this case you could probably have found that out with a quick call to apropos("registry") or even apropos("reg").)

这篇关于在 R 中访问 Windows 注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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