xrun1
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору @echo off Setlocal EnableDelayedExpansion set "your_choice=" :: Путь к файлам set "myPath=%~dp0" :: Получаем дату For /F "Tokens=1 Delims=." %%i In ('WMIC OS Get LocalDateTime^|Find "."') Do Set myDate=%%i set "myDate=%myDate:~6,2%.%myDate:~4,2%.%myDate:~0,4%" :: Если файла index.html никогда нет, 7 строк ниже можно удалить :check_file IF /I exist index.html set /P "your_choice=Файл index.html уже существует. Перезаписать? [Y(да)/N(нет)] " IF /I %your_choice% == Y goto begin IF /I %your_choice% == N goto end echo Повторите выбор действия. Y - означает перезапись файла index.html, N - завершение программы echo. goto check_file :begin echo ^<^!DOCTYPE html^> > index.html echo ^<html lang="en" dir="ltr"^> >> index.html echo ^<head^> >> index.html echo ^<meta charset="utf-8" /^> >> index.html echo ^<meta name="viewport" content="width=device-width, initial-scale=1" /^> >> index.html echo ^<title^>%myPath%^</title^> >> index.html echo ^</head^> >> index.html echo ^<body^> >> index.html echo ^<p^> >> index.html echo ^<font size="3" face="Arial"^> >> index.html echo ^<center^>This is place for your description^<br^> >> index.html echo You can fill it out yourself.^</center^> >> index.html echo ^<center^>%myDate%^</center^> >> index.html echo ^</p^> >> index.html echo ^<center^> >> index.html :: Получаем файлы в папке и нумеруем. Сортировка по умолчанию (наименование) set /a fNumber=0 For %%i IN (*.html) DO ( set /a fNumber+=1 echo ^<p^> >> index.html if !fNumber! LEQ 9 ( echo ^<a href="0!fNumber!. %%i" title=""^>0!fNumber!. %%~ni^</a^> >> index.html ) else ( echo ^<a href="!fNumber!. %%i" title=""^>!fNumber!. %%~ni^</a^> >> index.html ) echo ^</p^> >> index.html ) echo ^</center^> >> index.html echo ^</font^> >> index.html echo ^</body^> >> index.html echo ^</html^> >> index.html :end endlocal |