Pregunta

I have a .bat file that allows to the User to enter full File name (full Path) and I`m wondering if it is possible to validate if the user is entered for example .bak file?

¿Fue útil?

Solución

example:

set /p "FullPathNameData=Please enter the full path name of backup file for YourBackup: "
for /f "delims=" %%a  in ("%FullPathNameData%") do set "Extension=%%~xa"
if /i "%Extension%"==".bak" (echo %FullPathNameData% is a BAK file) else %FullPathNameData% is NOT a BAK file
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top