Question

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?

Était-ce utile?

La solution

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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top