@echo off setlocal set file=C:\Users\l72rugschiri\Desktop\fs.cfg for %%i IN ("%file%") DO ( echo filedrive=%%~di echo filepath=%%~pi echo filename=%%~ni echo fileextension=%%~xi )
Here is what the above code is Doing:
1. It sets the variable file to the path of the file you want to get the information from.
2. It then loops through the file and sets the variables filedrive, filepath, filename, and fileextension to the drive, path, name, and extension of the file.
3. It then echoes the variables to the screen.