简体   繁体   中英

special characters in a variable assistance

I'm trying to make a reg query a variable. I can get it to work in win10 but when I try XP it doesn't work. Its a reg query to determin .net4 installed.

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.

On XP as soon as it hits the setting variable element it just tries to install regardless that it's already installed. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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