Please I need help regarding my batch script. It was running perfectly, but later on when I wanted to run it keep repeating my previous result it displayed. eg I executed a
If you are running it in the same console window both times then the problem will likely be an uninitialised variable, and you are seeing the last result.
To use VBS to check the numbers then try this as the first part of your code.
Leave in the last goto :eof to stop it falling through the compare into the following code.
Check the final if compares to be sure they are doing what you want.
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set file="C:\Program Files (x86)\GE Aviation\AB139 HGS\DB\AW139 DB.gdb"
if not exist %file% goto :EOF
FOR %%A IN (%file%) DO set size=%%~zA
>"%temp%\math.vbs" echo Set objArgs = WScript.Arguments: num = objArgs(0) : result = 0
>>"%temp%\math.vbs" echo if num ^> 1073741824 then result=1
>>"%temp%\math.vbs" echo if num ^> 6442450944 then result=2
>>"%temp%\math.vbs" echo Wscript.echo result
for /f %%a in ('cscript /nologo "%temp%\math.vbs" %size% ') do set z=%%a
del "%temp%\math.vbs"
:: z will be 2 if %size% greater than 6442450944
:: z will be 1 if %size% greater than 1073741824
:: z will be 0 if %size% less than 1073741825
if %z% EQU 2 (goto EXECUTE)
if %z% EQU 1 (goto EXECUTE)
if %z% EQU 0 (goto LOGOUT)
goto :EOF