To echo
the full paths and filename of the files you are to drag/drop, without double quotes:
@echo off
(for %%a in (%*) do (
echo %%~a;
)
)> test.tmp
type test.tmp
pause
To include double quotes and full path:
@echo off
(for %%a in (%*) do (
echo %%a;
)
)> test.tmp
type test.tmp
pause
to echo filename only, without path:
@echo off
(for %%a in (%*) do (
echo %%~nxa;
)
)> test.tmp
type test.tmp
pause
and to echo
filename only, excluding path or extension:
@echo off
(for %%a in (%*) do (
echo %%~na;
)
)> test.tmp
type test.tmp
pause
type test.tmp
is just to show you the content of the file after written, you can remove it if you do not need it.
I suggest you also read the help for for
command:
Lastly, if you really want to set a variable (though not needed) you need to enabldelayedexpansion
or call echo %%b%%
by doubling the %