1
I have a for loop in this script: https://github.com/ITCMD/Explorer--/blob/master/Explorer--.bat
That looks like this: (:ModificationID
line 477
, called from lines 308
and 329
in :OtherVersions
)
set _ForString=%~1
set _ForString=!_ForString:\=\\!
wmic datafile where name="!_ForString!" get LastModified /format:list>out.temp
For /f "tokens=1,2* delims==" %%a in (out.temp) do (set %~2=%%b & echo hello)
where %~1 is equal to a file path. It outputs fine into out.temp as:
(2 blank lines)
LastModified=20181019082634.596899-240
(3 blank lines)
But the for loop never runs. It never even runs the echo command. Why?
I have it enabled for the entire script at the top. – Mark Deven – 2019-01-24T23:53:38.420
Ok thanks, I’ll make the change. Any idea why the old one wasn’t working? – Mark Deven – 2019-01-24T23:59:06.810
It seems to be related to the
FOR /F
loop and reading from the file with the blank spaces. – Pimp Juice IT – 2019-01-25T00:00:50.450It looks like it will, I’ll respond tomorrow when I test it. Thanks! – Mark Deven – 2019-01-25T00:20:38.300
This ended up working:
wmic datafile where name="!_ForString!" get LastModified /format:list>out.temp
For /f "tokens=2 delims==" %%a in ('type out.temp ^| find "="') do (set %~2=%%a)
. You should see an update for the linked file in the next week or so. – Mark Deven – 2019-01-25T14:43:16.003