In a batch file, I need to rip the filename from a URL, and set it to variable.
This doesn't work ("| was unexpected at this time."):
Code: Select all
REM Usage: mybatch.bat http://www.acme.com/myfile.html → extract "myfile.html"
REM OK echo %1 | sed "s/.*\///"
for /f %%i in ('echo %1 | sed "s/.*\///"') do set FILENAME=%%i
echo %FILENAME%
Thank you.