Click here to Skip to main content
13,735,232 members
Rate this:
 
Please Sign up or sign in to vote.
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 11-Oct-18 5:55am
Updated 11-Oct-18 6:18am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180920.1 | Last Updated 11 Oct 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100