Re: Convert current directory to DOS 8.3-friendly shortname
Currently, I just insert this line of code into my batch files that depend on %CD%
for %%i in ("%cd%") do set CD=%%~si
I saw a piece of code to make it a bit safer (in the above links). However, not sure how I would incorporate it into my code; or, if it would help any.
Maybe some code like this would make it more robust:
convert using var=%%~sA
if not exist "%var%\" remove last character and goto :loop
hopefully %var% here will be the short filename