Windows 7 batch file: Why are these IF blocks keeping me from assigning variables to a value?
Fresh3 days ago
Mar 15, 20267084 viewsConfidence Score0%
0%
Problem
Here's the broken batch file: However, when I take out the outer block like this, it works: When I run the batch file the first time, it echoes . When I run it the second time, it works fine:
Error Output
@echo off
if prod==prod (
if xps==xps (
set i1=prodxpsi1
set i2=prodxpsi2
set e1=prodxpse1
set e2=prodxpse2
)…Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Windows 7 batch file: Why are these IF blocks keeping me from assigning variables to a value?
Low Risk
This is a quirk of the command parser. Because of the brackets, it sees everything from to as one line. When it reads this "one line", it expands all the variables to their values before processing any of it. The commands all occcur after the variab…
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix