EDIT: Here is my complete code.
@echo off
cls
Set "file=%~f1"
Set "f_name=%~n1"
Set "n_name=%f_name: =_%"
Set "target=C:\Users\%USERNAME%\Desktop"
ffmpeg -i "%file%" ^
-dn ^
-an ^
-r 25 ^
-vcodec hap ^
-format hap_alpha ^
"%target%\%n_name%_Hap_alpha_v1.mov"
pause
I'm using this code to execute something on a given file. But if the file name includes spaces "file name Red_v3.mov" I only get "Red_v3.mov" as output on %%~nxF how to get the name including spaces? So that I can replace " " with "_" using set %file_1% %f_name: =_%
@echo off
set file=%~dpnx1
for %%F in (%file%) do (
Set f_ext=%%~nxF
Set f_name=%%~nF
)
echo %file%
echo %f_ext%
echo %f_name%
pause
Thanks Alex
%~dpnx1is the same as%~f1? Also double quote file names with spaces.