Solved: CMD – Comma And Apostrophe In File Name

working with com.whatsapp_2.17.35' 8-452027_minAPI15(armeabi,armeabi-v7a,mips,x86)(nodpi),
the %1, %~1 tries to parse a list of arguments
and will give you: com.whatsapp_2.17.35' 8-452027_minAPI15(armeabi.

%~s1 will fail too.

A workaround:
gulp the entire thing,
and re-parse content into short-path for easier usage.

@echo off
::                              enable Unicode support for path/file-name.
chcp 65001 2>nul >nul

::                              single arg - workaround weird file-name.
set "ARG=%*"
for /f %%a in ("%ARG%") do ( set 'ARG=%%~fsa' )

pure CMD:
the code above will generate a fully-qualified,
short (8.3-DOS like) path.

if you do need to pass more than one argument,
this is not the solution for you.

– – – – – –

The above code does not always works
since it will turn off any tries to parse single argument from the string,

Passing %* to other programs as an argument will always work,
but built-in handling of file-names, with apostrophes will still fail,
due to “by design” issues in CMD (wrapping phrases uses apostrophes..)

instead, try passing %* to GetShortPathName.exe from,
with the additional processing allowing empty-strings/empty-character (\0) and Windows API.
it will return a short 8.3 version of the path (relative or full),
if you want a fully qualified path try using GetFullPathName.exe from

You can use your choice of implementations, that simple one is written in VB6.