Batch Script: Why Is the first line failing? : I am trying to understand why the first line is failing from a batch script. 

    if exist reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion" goto OptionOne
    exit
    :OptionOne
    some code
    goto:eof


It never goes to OptionOne and just exits. I do have a solution to this problem written differently (so don't provide examples to make it work) but I want to understand why this one liner fails. Improper syntax? But google says its correct. Poorly designed code? I know the regkey exists so thats not it. Is it something with the return value and its correct syntax but needs to be further written out on the else statements?