Code: Select all
E:\Tools.vb\FC-Compiler\demos\ODEs-ivp>if not exist output\nul mkdir output
E:\Tools.vb\FC-Compiler\demos\ODEs-ivp>if exist scrout (
set mask=scrout
[b]for /R %a in ((null)) do (if %~za GTR 400 ([/b]
rem Some -good- output
copy scrout output\Beam.out 1>nul
copy scrout+output.txt E:\Tools.vb\FC-Compiler\~out.txt 1>nul
) ELSE (
copy scrout+output.txt E:\Tools.vb\FC-Compiler\~out.txt 1>nul
copy scrout+output.txt output\Beam.out 1>nul
) )
copy scrout scrout.txt 1>nul
del scrout 1>nul
) ELSE (
copy output.txt E:\Tools.vb\FC-Compiler\~out.txt 1>nul
copy output.txt output\Beam.out 1>nul
)
E:\Tools.vb\FC-Compiler\demos\ODEs-ivp>set FCtmp=Beam.fc
E:\Tools.vb\FC-Compiler\demos\ODEs-ivp>if /I fc == exp set FCtmp=
E:\Tools.vb\FC-Compiler\demos\ODEs-ivp>if /I fc == exe set FCtmp=
E:\Tools.vb\FC-Compiler\demos\ODEs-ivp>if /I fc == obj set FCtmp=
E:\Tools.vb\FC-Compiler\demos\ODEs-ivp>if exist "C:\Program Files (x86)\Notepad+
+\notepad++.exe " (
echo "C:\Program Files (x86)\Notepad++\notepad++.exe " -alwaysOnTop Beam.fc out
put\Beam.out
"C:\Program Files (x86)\Notepad++\notepad++.exe " -alwaysOnTop Beam.fc output\
Beam.out
) else (C:\Windows\notepad.exe output\Beam.out )
"C:\Program Files (x86)\Notepad++\notepad++.exe " -alwaysOnTop Beam.fc output\B
eam.out
E:\Tools.vb\FC-Compiler\demos\ODEs-ivp>dir Beam.out, output.txt, scrout.txt
Volume in drive E is Textbook
Volume Serial Number is 1E41-B870
Directory of E:\Tools.vb\FC-Compiler\demos\ODEs-ivp
Directory of E:\Tools.vb\FC-Compiler\demos\ODEs-ivp
11/21/2014 09:38 AM 4,924 OUTPUT.TXT
Directory of E:\Tools.vb\FC-Compiler\demos\ODEs-ivp
11/21/2014 09:38 AM 1,090 scrout.txt
Here is the batch code that generated the above echo.
Code: Select all
echo on
rem set f-out=%od-tools%\%FCdir%\...\output\%f-out%
if not exist output\nul mkdir output
if exist scrout (
set mask=scrout
for /r %%a in (%mask%) do (
[b]if %%~za gtr 400 ([/b]
rem Some -good- output
copy scrout [b]output\%f-out%[/b] > nul
copy scrout+output.txt %od-tools%\%FCdir%\~out.txt > nul
[b] ) ELSE ([/b]
copy scrout+output.txt %od-tools%\%FCdir%\~out.txt > nul
copy scrout+output.txt [b]output\%f-out%[/b] > nul
)
)
copy scrout scrout.txt > nul
del scrout > nul
) ELSE (
copy output.txt %od-tools%\%FCdir%\~out.txt > nul
copy output.txt output\%f-out% > nul
)
set FCtmp=%FCname%.%FCext%
if /I %FCext%==exp set FCtmp=
if /I %FCext%==exe set FCtmp=
if /I %FCext%==obj set FCtmp=
if exist "C:\Program Files (x86)\Notepad++\notepad++.exe " (
echo "C:\Program Files (x86)\Notepad++\notepad++.exe " -alwaysOnTop %FCtmp% output\%f-out%
"C:\Program Files (x86)\Notepad++[i]\notepad++.exe[/i] " -alwaysOnTop %FCtmp% [b]output\%f-out%[/b]
) else (
%WINDIR%\notepad.exe output\%f-out%
)
Hmm, ... in above code didn't work. I was trying to make bold the important parts of code.
Here is the code that is key to this problem.
for /r %%a in (%mask%) do (
if %%~za gtr 400 (
copy scrout output\%f-out% > nul
) ELSE (
copy scrout+output.txt output\%f-out% > nul
)
Either route should create an output\%f-out% file.
Both 'scrout' and 'output.txt' files exist at this time.
When the output file, %f-out% = Beam.out here, filesize is small ... 1,090 bytes. It is also a very fast run. I can't read the echo response to figure out what code got executed on the filesize test, see BOLD lines of code and Echo response. On slower runs where the %f-out% is of larger filesize, this batch code works fine. \notepad++.exe complains about opening a non-existent file, output\%f-out%.
Ideas how to solve this batch code?
Thanks.