更新时间:2023-12-04 22:11:40
这仅允许使用字母,数字和破折号:
This allows only letters, numbers, and dashes:
@echo off & setlocal
:top
set /P "name="Enter a name: "
setlocal enabledelayedexpansion
echo(!name!| findstr /i "[^a-z0-9-]" >NUL && (
endlocal
set /P "=Invalid name. " <NUL
goto top
)
endlocal
echo Thank you %name%!
pause