1

My Application.exe takes a filename as a parameter.

I would like to write a windows batch file script that does the following:

Lets me point to a folderpath and does the following:

 for int = 0 ; i<folderpath.filecount();i++
{
  Application.exe filename[i]
}

Many Thanks

1 Answer 1

2

use the for command. For example (FIXED)

for %%i in (%1\*) do Application.exe "%%i"

see help for for lots of extra useful options and syntax.

Sign up to request clarification or add additional context in comments.

5 Comments

Error: '/*) was unexpected at this time' ..need a bit more help on this...or am i being dense?
@evil otto: Seems like you've mixed up the %/%% usage. It should be %%i (both of them) and %1. And to play safe, it might be better to use \ as the path delimiter. One other thing: the second occurrence of %%i might need to be enclosed in double quotes.
So... for %%i in (%1*) do Application.exe %%i or for %%i in (%1*) do Application.exe "%%i"
@Andriy M - you're completely right; serves me right for writing it from memory.
@van: Yes, @​evil otto has been good enough to amend his solution, so you can use it for reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.