I thought I found a golden egg, but unfortunately it doesn't work if the last path is missing a slash.
At this point the result is faulty as DOS assumes a path must have an ending slash.
This is a problem as paths don't have to have an ending slash to be a valid path
Code: Select all
for %%r in (
) do for %%r in ("%%~dpr.") do echo ParentFolderName = "%%~nxr"
ParentFolderName = "Works"
ParentFolderName = "Works"ParentFolderName = "This"
ParentFolderName = "This"
ParentFolderName = ""
Druk op een toets om door te gaan. . .
And even 'This Works.TMP' could be a path, there really is no way of being sure.