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:
: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>%txtLoc%
@echo %trunk%.%build% >>"%txtLoc%"
@echo %TA%>>"%txtLoc%"
@echo %mdbname%>>"%txtLoc%"
REM ~1 is status
@echo %~1>>"%txtLoc%"
@echo %mytime% %mydate%>>"%txtLoc%"
@echo %notes%>>"%txtLoc%"
REM Sets location on server to store data
SET txtLocRemote=\\cd-ptt\CAD Downloads\Webserver\servers\*
xcopy %txtLoc% "%txtLocRemote%" /q /y
)
goto:eof