We help IT Professionals succeed at work.
Get Started

Dos Batch Echo to File an Echo to File

mploschiavo asked
Last Modified: 2008-01-09
i am creating a script in dos that writes another bat script.  my problem is with Echo to File an Echo to File
this is the current script:
For /f "tokens=*" %%a in ('dir /a-d /b /s *.sql') do (
     ECHO echo. >> log.txt >> %ScriptName%
     ECHO echo "%%a" >> log.txt >> %ScriptName%
     ECHO osql -S %%1 -d %%2 -U %%3 -P %%4 -b -i "%%a" >> log.txt  >> %ScriptName%

the result of the script executing gives me the following
echo "R:\db\1.0\Functions\\fn_regex.sql"
osql -S %1 -d %2 -U %3 -P %4 -b -i "R:\db\1.0\Functions\fn_regex.sql"

this is close but
i want the result to show:
echo. >>log.txt
echo "R:\db\1.0\Functions\\fn_regex.sql" >>log.txt
osql -S %1 -d %2 -U %3 -P %4 -b -i "R:\db\1.0\Functions\fn_regex.sql" >>log.txt

any ideas?  
i tried using
::setting v = ">"
SET v=<0×1E>
and substituting %v%%v% for >> but this does not work.  maybe i am just using hex wrong.
Watch Question
Top Expert 2007
This problem has been solved!
Unlock 2 Answers and 3 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE