Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a windows batch script with wildcard filenames as command line arguments

I have a little windows batch script that does nothing but prints all its command line arguments (proba.bat)

@echo off
:loop
  if "%~1"=="" goto cont
  echo %1
  shift & goto loop
:cont

I expected that this script would print all .mp4 files if I call it like this:

proba *.mp4

But instead it simply prints *.mp4 literally. This would be so easy on linux, but here I can not get it work. What am I doing wrong?

Thank you

like image 471
user3555951 Avatar asked Apr 21 '14 08:04

user3555951


1 Answers

This emulates what you are trying to do:

@echo off
for %%a in ("%~1") do echo "%%a"
like image 81
foxidrive Avatar answered Oct 20 '22 17:10

foxidrive