Batch Files to run HTML Tidy from the Windows command prompt
HTML 5 Batch Files
XHTML 1.0 Transitional Batch Files
HTML Tidy documentation explains the settings in the files below. Two settings require mention. First, the batch files assume the input files use UTF-8 character encoding. Second, the newline option is set to save files in the Unix / Linux format.
W3.org Resources
Character Encoding Declaration
CSS Validation Service
Language Declaration
Nu HTML Checker
Batch files for individual files can be run on files that also contain script, PHP, ASP, etc. However, the batch files for groups of files assume an HTML file extension.
th.bat - When run, "th filename," runs Tidy on the file.
@echo .
@echo .
@tidy --doctype html5 --output-html yes --char-encoding utf8 --newline lf --clean yes --indent auto --vertical-space yes --tidy-mark no --wrap 0 --write-back yes %1
thall.bat - When run, "thall," runs Tidy on all HTML files in the active directory and its subdirectories.
for /f "tokens=*" %%a in ('dir /b /s *.html') do tidy --doctype html5 --output-html yes --char-encoding utf8 --newline lf --clean yes --indent auto --vertical-space yes --tidy-mark no --wrap 0 --write-back yes "%%a" | echo file: %%a
@echo .
@echo .
@dir *.html /o:d
tt.bat - When run, "tt filename," runs Tidy on the file.
@echo .
@echo .
@tidy --doctype loose --output-xhtml yes --char-encoding utf8 --newline lf --clean yes --indent auto --vertical-space yes --tidy-mark no --wrap 0 --write-back yes %1
ttall.bat - When run, "ttall," runs Tidy on all HTML files in the active directory and its subdirectories.
for /f "tokens=*" %%a in ('dir /b /s *.html') do tidy --doctype loose --output-xhtml yes --char-encoding utf8 --newline lf --clean yes --indent auto --vertical-space yes --tidy-mark no --wrap 0 --write-back yes "%%a" | echo file: %%a
@echo .
@echo .
@dir *.html /o:d
Hardcover Web Design