简体   繁体   English

可变辅助中的特殊字符

[英]special characters in a variable assistance

I'm trying to make a reg query a variable. 我正在尝试使reg查询成为变量。 I can get it to work in win10 but when I try XP it doesn't work. 我可以在win10中使用它,但是当我尝试XP时它不起作用。 Its a reg query to determin .net4 installed. 它是一个reg查询,用于确定安装的.net4。

set "net4=REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP" | find /i "4.0" > NUL || ".NetFx40.exe" /passive /norestart"

to test on win 10, if I change 4.0 to 5.0 the installer starts, leave on 4 it skips as expected. 要在win 10上进行测试,如果我将4.0更改为5.0,则安装程序将启动,请保留4,它会按预期跳过。

On XP as soon as it hits the setting variable element it just tries to install regardless that it's already installed. 在XP上,只要碰到设置变量元素,它就会尝试安装,无论它是否已经安装。 I'm guessing the pipes and things are breaking the entry, how can I resolve this, thanks. 我猜是管道和事情打破了记录,我该如何解决这个问题,谢谢。

这是J.Baoby建议的工作方式

set net4=REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP" ^| find /i "4.0" ^> NUL ^|^| ".NetFx40.exe" /passive /norestart

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM