1.

Solve : For Loop and option ... delims="?

Answer»

Hi all,
Am doing the following...

schtasks /query /s %Server2Chk% /FO CSV /NH /V | findstr /C:"%SearchString%" > %TempFile1%

Sample Output ...
[size=10]"CAMS-LAPTOP","test","15:18:00, 06/04/2006","Could not start","14:02:34, 06/04/2006","0","cyoung","Every 30 minute(s) from 13:18 for 1438 minutes every day, starting 06/04/2006","C:\test.bat ","C:\","N/A","Enabled","Minute ","13:18:00","06/04/2006","N/A","Everyday","N/A","CAMS-LAPTOP\xxx","Disabled","72:0","30 Minute(s)","None","23 Hour(s): 58 Minute(s)","Disabled","Disabled","No Start On Batteries, Stop On Battery Mode"[/size]

Then ... I try to do the following ...

[size=11]for /F "tokens=1,2,3,4 delims="" %%j in (%TempFile1%) do call %0 UpdateTask %%j %%k %%l %%m[/size][/color]

I'd like to have the (") as the delimiter - is it possible? I just don't WANT quotes around the resulting tokens if I'm forced to USE `delims=,`.

Hope that makes sence & many thanks in advance.CameronY,

Use the tilde to trim the quotes, i.e. %%[HIGHLIGHT]~[/highlight]j %%[highlight]~[/highlight]k %%[highlight]~[/highlight]l %%[highlight]~[/highlight]m

for /F "tokens=1,2,3,4 delims="" %%j in (%TempFile1%) do call %0 UpdateTask %%~j %%~k %%~l %%~m

That WORKS, right ?

It's described in the COMMAND reference for the for command: http://dostips.cmdtips.com/DosCommandRef.htm#for



Discussion

No Comment Found