Not solving your problem, but your code is very inefficient. Instead of executing the macro repeatedly, set it to a variable once, then test against the variable.
 Code:
PTYPE=@PRODUCTTYPE


Then, with your if statements, they all have to be executed. I think using a select case construct would be more efficient:

 Code:
Select
   Case $PTYPE = "Windows 6.1 /1"
      $OSTYPE = "Workstation"
   Case $PTYPE = "Windows 10 Pro(N)"
      $OSTYPE = "Workstation"
etc
EndSelect