批处理文件-reg查询-获取和比较值 [英] Batch File - reg query - get and compare values

查看:432
本文介绍了批处理文件-reg查询-获取和比较值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试编写一个批处理文件,以检查是否安装了.NET 3.5.我知道运行以下命令会产生结果:

Hi all,

I am trying to write a batch file that checks if .NET 3.5 is installed. I know that running the following command produces the result:

reg query "HKEY_Local_Machine\Software\Microsoft\NET Framework Setup\NDP\v3.5" /v Install



但是,如何获取值(0或1)并在if语句中使用它,以便知道是否要安装.NET?

提前非常感谢.
亲切的问候,



But how can I get hold of the value (0 or 1) and make use of it in an if statement, so that I know whether to install .NET or not?

Many thanks in advance.
Kind regards,

推荐答案

嗨Programm3r,

我现在正在使用Ubuntu进行答复,所以我现在无法对其进行测试,但是您正在寻找的东西是这样的:

Hi Programm3r,

I''m answering using Ubuntu right now so I couldn''t test it right now but what you''re looking for is something like:

For /F %%A In (''reg query "HKEY_Local_Machine\Software\Microsoft\NET Framework Setup\NDP\v3.5" /v Install'') do goto skip

Echo reg value not found 

goto done

:skip

Echo reg value found 

:done




祝你好运!




Good luck!


这篇关于批处理文件-reg查询-获取和比较值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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