When it comes to batch-to-HTML files, it's good to know that friends who like to read novels or often make ebooks and tutorials. Because we are faced with thousands of txt files each time, it is cumbersome to convert them into HTML files that are displayed correctly. Of course, there are a lot of software can be achieved, but I also under a lot of software, tried many times, the results are unsatisfactory. So I made a batch to solve this problem, and now share it with you.
Our batch tool is still saved with the original file name after conversion to HTML, and the default first action header row and page name ! So make sure that the first line of all txt files has a title, otherwise the first paragraph will be the title.
In order to ensure that the conversion results will not be garbled, before the conversion we want to determine the encoding of the TXT file before conversion to UTF-8, because UTF-8 is the common format of the Web page, many browsers by default are in UTF-8 encoded format opened. If all your txt files are GB2312 encoded, I will publish the batch of GB2312 to UTF-8 in the next article, so please look forward to not repeating them here.
Back to the Chase, copy the following code (split line below) into a notepad and save as "TXT batch to HTML tool. Bat"
---------------------Split Line---------------------
@echo off set utf8=65001set ansi=936chcp %utf8% for /f "delims=" %%i in (‘dir /b *.txt‘) do (findstr /n .* "%%i" >.tmp(echo ^