-
-
Save soiqualang/fb7c952cdd805c0863c4a3e32fecb65b to your computer and use it in GitHub Desktop.
How to get filename, dirname, and basename in bat?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set filepath="C:\some path\having spaces.txt" | |
for /F "delims=" %%i in (%filepath%) do set dirname="%%~dpi" | |
for /F "delims=" %%i in (%filepath%) do set filename="%%~nxi" | |
for /F "delims=" %%i in (%filepath%) do set basename="%%~ni" | |
echo %dirname% | |
echo %filename% | |
echo %basename% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment