Ramin
Ramin

Reputation: 43

the "echo %~dps0" doesn't function right on windows platform

put echo %~dps0 in a bat file under c:\Program Files (x86)\new folder folder. the output of this bat file is:

c:\PROGRA~2\new folder\

the last part of this path is not convert to short path.

could someone have any ideas?

Upvotes: 4

Views: 2825

Answers (1)

MC ND
MC ND

Reputation: 70943

You will obtain this behaviour if you/someone have disabled the generation of short names in the volume. There will short names for the files/folders created before the disable (if they have not been stripped), but new files/folders will not obtain a short name.

Try to execute fsutil behavior query disable8dot3 c: to see if it has been disabled. If this is the case, fsutil 8dot3name set c: 0 will enable it again. But you will have to recreate the files/folders to force the generation of short names.

Upvotes: 3

Related Questions