Rename filename to remove invalid characters?
Posted: 27 May 2023 00:43
Hello,
I'd like to use an HTML's title as filename, but it may contain invalid characters like question marks, etc.
Do you know of a way to rewrite a string so that it's DOS-legit?
Thank you.
--
Edit: One way I came across:
I'd like to use an HTML's title as filename, but it may contain invalid characters like question marks, etc.
Do you know of a way to rewrite a string so that it's DOS-legit?
Code: Select all
FOR /F "delims=" %%A IN ('xidel "%1" -se "title:=//title" --output-format cmd') DO %%A
echo %title%
wget -O "%title%.html" "%1"
--
Edit: One way I came across:
Code: Select all
SET title=%title: =_%
SET title=%title:?=%
echo %title%