Batch to output va file then del 1st file

October 26, 2010 at 05:08:32
Specs: Windows XP
Hi All,

I already have code to read a query on the 2nd line,

Now i like to output this var to a file.
Then delete the earlier file --> "myfile"


@echo off & setLocal EnableDELAYedeXpansion

for /f "skip=1 tokens=* delims= " %%a in (myfile) do (
set V=%%a
goto :done
)
:done
echo.!V!

Thanks in advance


See More: Batch to output va file then del 1st file

Report •

#1
October 26, 2010 at 09:01:56

echo.!var!> newfile
del myfile

By the way what you want to achieve is done in an easier way as below

@echo off
for /F "skip=1 delims=" %%a in (myfile do (
   echo.%%a> newfile
   goto :done
)
:done
del myfile


Report •

#2
October 26, 2010 at 19:52:53
I face and error

> was unexpected at this time.


Report •

#3
October 26, 2010 at 20:21:05
Got it just missing the close bracket ") "

@echo off
for /F "skip=1 delims=" %%a in (result.txt) do (
echo.%%a > newfile.txt
goto :done
)
:done
del result.txt

Thank you IVO...
This forum rocks ;-)


Report •
Related Solutions


Ask Question