shell脚本读取注册表 [英] Shell script reading windows registry

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

问题描述

我需要为这是应该读取Windows注册表中的nvidia驱动版本一个小的shell脚本一些帮助。

I need some help for a small shell script which is supposed to read the nvidia driver version from the windows registry.

基本上,在Windows命令(在DO​​S提示符下正常工作)如下:

Basically, the windows command (which works fine in dos prompt) is the following:

REG QUERY "HKLM\SOFTWARE\NVIDIA Corporation\Installer" /v Version

所以很自然,我试着从shell脚本运行:

So naturally, I try to run it from the shell script:

CMD //C 'REG QUERY "HKLM\SOFTWARE\NVIDIA Corporation\Installer" /v Version'

但它说,关键名称无效。我的猜测是,双引号misinter preTED(因为错误的语法最有可能的)。

But it says that the key name is invalid. My guess is that the double quotes are misinterpreted (because of wrong syntax most likely).

我已经试过几件事情就像在一个批处理脚本进入这个code和执行从外壳批次。会出现同样的问题。

I have tried several things like entering this code in a batch script and executing the batch from shell. The same problem occurs.

任何人都可以在这方面的帮助?

Can anybody help on this ?

在此先感谢!

帕特

推荐答案

// C是无效的cmd.exe的语法,使用/ C。

//C is not valid cmd.exe syntax, use /C.

但也没有必要在批处理文件中使用CMD / C,使用调用:呼叫someapp.exe

But there is no need to use cmd /C in a batch file, use call: call someapp.exe

是不合法的报价。

尝试:

call REG QUERY "HKLM\SOFTWARE\NVIDIA Corporation\Installer" /v Version

这篇关于shell脚本读取注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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