I'm using Windows 7.
I have a program called optAlg.exe that I'm calling within a for loop of a batch script, and I want to redirect the output of optAlg.exe to %outputFile%. When I run the following loop in a batch script, the output of optAlg.exe is written to the console.
for %%i in (data/5Node/*.dat) do @(
set inputFile=%%i
set outputFile="%inputFile%.out"
optAlg %inputFile% 500 ^> %outputFile%
)
How can I get this to output to a file instead of the console?
EDIT: what I'm trying to do, is have it call
optAlg 1.dat 500 > 1.dat.out
optAlg 2.dat 500 > 2.dat.out
...
optAlg n.dat 500 > n.dat.out
where the .dat files I have are named 1.dat through n.dat
>>for starters, also why do u need an escape character? I think thats whats preventing the content from be redirected.set x=%var%within a loop does not work the way you think. It will be the last valuevarholds unless you tell it to loop normally ( the way you would expect ) viasetlocal enabledelayedexpansionand use associated!var!syntax in place of the usual%var%syntax. dos is a tricky world - I had to write a lot of these scripts back in the day >.<