Computing.Net > Forums > Windows 2000 > for loop emtpy str detection

for loop emtpy str detection

Reply to Message Icon

Original Message
Name: taiwf
Date: September 25, 2005 at 19:19:15 Pacific
Subject: for loop emtpy str detection
OS: win2k
CPU/Ram: p4 celeron/512Mb
Comment:

Hi,

I try to catch the empty string present in for loop but somehow it never does the job... Basically i try to search sth thats not existed and i put a "" around that variable which suppose to give "". But somehow it still doesn't work.

-------------my script below---------
::@echo off
setlocal disabledelayedexpansion
for /f "tokens=2 delims=##" %%A IN ('vol b: c: e: 2^>NUL') do (

SET myvar=%%A
echo %%A
if /I "%myvar%" EQU "" (
echo "None of backup hard disk is detected!!"
call cscript mail_err.vbs >NUL
)
)

endlocal
-------------i got the following result------


C:\batch\dumping>setlocal disabledelayedexpansion

C:\batch\dumping>for /F "tokens=2 delims=##" %A IN ('vol b: c: e: 2>NUL') do (
SET myvar=%A
echo %A
if /I "%%A" EQU "" (
echo "None of backup hard disk is detected!!"
call cscript mail_err.vbs 1>NUL
)
)

C:\batch\dumping>endlocal
-----
i tried if /i ... or just if ... which give me no different result.

Can anyone please give me some hint?

thank in advance
Dav



Report Offensive Message For Removal








Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: for loop emtpy str detection

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge