Why is my if statement within a function causing an error in batch?
<p>I am coding a batch install script and I am trying to have this function run only if a certain variable is equal to 1. Whenever call this funtion I a normal syntax command("The syntax of the command is incorrect") followed by on the next line 
"C:\Windows\System32>                          break>"
The code is below:</p>

<pre><code>:updateStatus
IF %uploadInfo% EQU 1 (

    REM finds IP
    set ip_address_string="IP Address"
    set ip_address_string="IPv4 Address"
    for /f "usebackq tokens=2 delims=:" %%f in (`ipconfig ^| findstr /c:%ip_address_string%`) do (
        SET ip=%%f
        REM  goto :eof  
    )

    REM Removes spaces from IP
    SETLOCAL ENABLEDELAYEDEXPANSION
    for /f "tokens=* delims= " %%a in ("%ip%") do set ip=%%a
    for /l %%a in (1,1,100) do if "!ip:~-1!"==" " set ip=!ip:~0,-1!
    REM echo IP Adress: %ip%

    SET txtLoc=C:\CadVersionInfo\%ip%.txt
    SETLOCAL  DISABLEDELAYEDEXPANSION

    REM SETs time
    For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%a/%%b/%%c)
    For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a:%%b)

    REM writes info
    if not exist C:\CadVersionInfo\ (mkdir C:\CadVersionInfo\)


    if exist "%txtLoc%" (
        del "%txtLoc%"
    )


    break&gt;%txtLoc%


    @echo %trunk%.%build% &gt;&gt;"%txtLoc%"
    @echo %TA%&gt;&gt;"%txtLoc%"
    @echo %mdbname%&gt;&gt;"%txtLoc%"
    REM ~1 is status
    @echo %~1&gt;&gt;"%txtLoc%"
    @echo %mytime% %mydate%&gt;&gt;"%txtLoc%"

    @echo %notes%&gt;&gt;"%txtLoc%"

    REM Sets location on server to store data
    SET txtLocRemote=\\cd-ptt\CAD Downloads\Webserver\servers\*
    xcopy %txtLoc% "%txtLocRemote%" /q /y
 )
goto:eof
</code></pre>