Sure, that's the same link. jaclaz I am extremely sorry for doing so, I was i hurry to solve the problem, and after it solved, i was busy with another problem. So sorry again, and in future i will not do the same.. JusTy
Hi All, I have created following batch file which will read value from a text file and set a variable. But somehow it's not working, to debug, i have added several pause on the file, and found that it's automatically closing after executing FOR statement. But if i execute the for statement on direct command line it's working and also it's setting the variable. Please help me to fix this @echo off pause FOR /F "tokens=2" %a in (C:\chk.txt) do set _port=%a pause ::set _reg=open if "%_port%" == "open" ( echo : True : pause exit) echo : False : pause exit Content of the chk.txt is: 25/tcp open smtp After executing FOR statement directly on command prompt. C:\>FOR /F "tokens=2" %a in (C:\chk.txt) do set _port=%a C:\>set _port=open C:\>echo %_port% open C:\>