win7 dir,i need delims= to seperate lines

February 11, 2011 at 17:49:57
Specs: Windows 7
::SETLOCAL ENABLEDELAYEDEXPANSION


echo off
dir "*.iso" /b /oN > temp1.txt
type temp1.txt
echo.-----------------------------------

for /f "delims=" %%I in (temp1.txt) do (

echo.-----------------------------------

set IDT1=%%I
set IDT2=%IDT1:.iso=%

echo.%IDT1%
echo.%IDT2%

)

but i get e.g.
R:\to do>echo off
name1.iso
name2.iso
name3.iso
name4.iso
name5.iso
name6.iso
name7.iso
name8.iso
-----------------------------------
-----------------------------------
name8.iso
name8
-----------------------------------
name8.iso
name8
-----------------------------------
name8.iso
name8
-----------------------------------
name8.iso
name8
-----------------------------------
name8.iso
name8
-----------------------------------
name8.iso
name8
-----------------------------------
name8.iso
name8
-----------------------------------
name8.iso
name8
-----------------------------------

notice it just notices the last "iso" file...

i have a small exe that extracts the ISO unsing IDT1 as the name and IDT2 as a directory on another drive


See More: win7 dir,i need delims= to seperate lines

Report •


#1
February 11, 2011 at 19:41:46
You found a variable expansion issue:
http://www.computing.net/howtos/sho...

It can be fixed by using delayed expansion/marking the vars with !'s, but I suggest you have a look at the for variable modifiers



for /f "delims=" %%I in ('dir "*.iso" /b /oN') do (

    echo %%~fI
    echo %%~nxI
    echo %%~dpnI
    echo %%~nI
)


Report •

#2
February 12, 2011 at 02:22:28
thats SO much - thats a great article - i had searched 4 about 2 hours to find an answer,. Cheers

for /f "delims=" %%I in (temp1.txt) do (
echo.-----------------------------------
	set IDT1=%%I
	set IDT2=!IDT1:.iso=!
	echo.!IDT1!
	echo.!IDT2!
md "G:\Games\_"!IDT2!


Report •

#3
February 12, 2011 at 02:36:39
No problem, glad I could help.

Report •

Related Solutions

#4
February 13, 2011 at 13:59:12
@ xakmad . If the help was helpful should you Vote it :)
Give the credit where its due.

Subhash Chandra.
www.s-chandra.co.cc


Report •


Ask Question