-2

I have a file testfile.exe that runs with parameters like below:

testfile.exe c:\path1\file.txt 3 c:\path2\file2.txt

The second parameter 3 is a sampling factor.

So I run the application with the parameters:

  • input file with path
  • a sampling factor
  • output file with path

What would be needed in a batch file to search in a source directory for all files with a specific file extension and run the command with the input/sample/output parameters?

Mofi
  • 46,139
  • 17
  • 80
  • 143
mgdicom
  • 3
  • 4

1 Answers1

0

This worked:

set "SourceFolder=c:\path1"
set "OutputFolder=c:\path2"
set "SampleFactor=1"
for %%a in ("%SourceFolder%\*.ext") do (
    example.exe "%%a" "%SampleFactor%" "%OutputFolder%\%%~na.ext"
)
Mofi
  • 46,139
  • 17
  • 80
  • 143
mgdicom
  • 3
  • 4
  • All file/folder names without or with path containing a space or one of the characters ``&()[]{}^=;!'+,`~`` must be enclosed in double quotes. Open a command prompt window, enter `cmd /?` and read the output help pages where on last paragraph on last help page you can read about this list. I modified your not working code to the working code above. – Mofi Aug 16 '16 at 11:26