Change the contents of the batch file "C:\Path\of\my\batch.bat" to
echo %*
Your ASSOC and FTYPE seem correct.
Change as per Monacraft comment.
This is the correct solution, since %1 will refer to the document file name, while %* will refer to additional parameters: if any additional parameters are required by the application, they can be transferred as %2 , %3 . To transfer all parameters to the application, use %* .
It is convenient to use aFile.myext abc directly from the command line, although to do this, use the FTYPE statement
FTYPE MY.FILETYPE = cmd / D / C "C: \ Path \ of \ my \ batch.bat"% 1 ""% *
to distinguish the first parameter if it contains spaces.
Example : with
ASSOC .xxx=XXXFILE rem a bug here FTYPE XXXFILE=%ComSpec% /D /C "d:\bat\xxxbatch.bat "%1"" %* rem definitely switched to Jeb solution as follows FTYPE XXXFILE=%comspec% /D /C call "d:\bat\xxxbatch.bat" "%1" %*
and xxxbatch.bat as follows
@echo( @echo %* @if "%2"=="" pause @goto :eof
Exit
d:\bat>D:\test\xxxFileNoSpaces.xxx aa bb cc "D:\test\xxxFileNoSpaces.xxx" aa bb cc d:\bat>"D:\test\xxx file with spaces.xxx" dd ee "D:\test\xxx file with spaces.xxx" dd ee d:\bat>
source share