Saturday, 15 February 2014

cmd - Batch file new line problems -



cmd - Batch file new line problems -

i'm tearing hair out now.

i have batch file searches through sub directories looking jpg files , parses simple html code using file names finds , pushes text file.

it vitally of import each line of every file created separated blank line.

this why have included "echo." lines. see batch file code below:

pushd \\srvapp1\image archive echo %cd% pause /r %cd% %%f in (*.jpg) ( echo %%~nf echo. echo ^<html^>^<img src='^.%%~pnxf' ^>^<a href='^.%%~pnxf'^>download file^<^/a^>^<^/html^> echo. echo ^[^[open file^|file^:^.%%~pnxf^]^] echo. echo ^[^[show in folder^|file^:^.%%~pf^]^] ) > ".\documentation\%%~nf.tid" popd pause

the loop iterates through first sub directory fine , creates perfect output. illustration below

yorym_ta1 <html><img src='.\2014-03-13\jpg\yorym_ta1.jpg' ><a href='.\2014-03-13\jpg\yorym_ta1.jpg'>download file</a></html> [[open file|file:.\2014-03-13\jpg\yorym_ta1.jpg]] [[show in folder|file:.\2014-03-13\jpg\]]

however, when batch file moves onto sec directory - , subsequent directories "echo." seems replaced "echo.." , next output (complete total stops instead of blank lines):

yorym_h2200_8 . <html><img src='.\2014-05-22\jpg\yorym_h2200_8.jpg' ><a href='.\2014-05-22\jpg\yorym_h2200_8.jpg'>download file</a></html> . [[open file|file:.\2014-05-22\jpg\yorym_h2200_8.jpg]] . [[show in folder|file:.\2014-05-22\jpg\]]

any ideas why may occurring? running windows 7.

i've got solution, no explanation:

use echo( instead of echo.

batch-file cmd echo

No comments:

Post a Comment