Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

On running below batch script my second last IF condition is not working:

Batch code:

set count_slu=0
for %%A in (C:\SLU\*accounts*.xml) DO SET /A count_slu+=1
ECHO Netsol ACCOUNTS File SLU_COUNT: %count_slu% >> C:\SLU\Netsol_SLU_File_Delay\Net_Account_Log_%dt%.txt

echo ============= Netsol ACCOUNTS Log Completed (%dt% %time:~0,2%:%time:~3,2%:%time:~6,2%)========== >> \\TDC1FIL001\Systems\SLU\Netsol_SLU_File_Delay\Net_Account_Log_%dt%.txt

echo %count_slu% >> C:\Systems\SLU\Netsol_SLU_File_Delay\Net_Account_Log_%dt%.txt

if "%count_slu%" EQU 0 ( Echo get out >> C:\SLU\Netsol_SLU_File_Delay\Net_Account_Log_%dt%.txt)
echo End C:\SLU\Netsol_SLU_File_Delay\Net_Account_Log_%dt%.txt


LOG FILE OUTPUT:

============= Netsol ACCOUNTS Log Completed (11_10_2018 16:45:59)==========
0
END




Why did the if "%count_slu%" EQU 0 ( Echo get out >> C:\SLU\Netsol_SLU_File_Delay\Net_Account_Log_%dt%.txt)
DID NOT PRINT THE OUTPUT ?

What I have tried:

Tried changing the case , spaces, couldnt understand
Posted
Updated 11-Oct-18 6:18am

1 solution

if "%count_slu%" EQU 0 ( Echo get out >> C:\SLU\Netsol_SLU_File_Delay\Net_Account_Log_%dt%.txt)

Remove the double quotes around "%count_slu%", or add double quotes round the 0. You are trying to compare "0" with 0.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900