https://bugs.winehq.org/show_bug.cgi?id=56399
--- Comment #5 from tncgyp+uypezc35u0dyxed6tszn0wk59xjphxb2gcxycxno8mxg4od48@sharklasers.com --- I wouldn't say in general that cmd %~s should behave like winepath -s. Wine's cmd %~s should behave like Microsoft's cmd %~s. That means the existing part of the path is converted to short format and the non-existing part remains unchanged. After some playing around I can say that winepath -s seems to do exactly that, i.e. winepath -s is at least significantly closer to Microsoft's cmd %~s than Wine's current cmd %~s. All winepath -s does to achieve this is to call GetShortPathNameW, nothing else.
The proposed modification therefore simplifies to:
/* 4. Handle 's' : Use short paths (File doesn't have to exist) */ if (wmemchr(firstModifier, 's', modifierLen) != NULL) { if (finaloutput[0] != 0x00) lstrcatW(finaloutput, L" "); GetShortPathNameW(fullfilename, fullfilename, ARRAY_SIZE(fullfilename)); }
I think this modification can only break batch scripts written exclusively for Wine that rely on the current cmd %~s behavior.