0

I have a curstom command that is an query language interpretor. And the file contains some queries to execute.

I want to execute this custom command by passing the whole file content as parameter with a single command.

For exemple somethink like :

myCustomCmd %type params.txt%

Is it possible ?

Thanks

Guillaume S
  • 1,462
  • 2
  • 19
  • 31
  • possible duplicate of [Windows batch assign output of a program to a variable](http://stackoverflow.com/questions/2323292/windows-batch-assign-output-of-a-program-to-a-variable) – beny23 Feb 04 '15 at 14:08

1 Answers1

1
for /f "usebackq delims=" %%a in ("params.txt") do myCustomCmd %%a

should draw that line from the file and use it as a parameter for you command.

Had you given us a context, I'd be able to provide more information.


Ah - you want "the entire file content" as the parameter - a requirement you edited-in five minutes after I'd posted this response...

@echo off
setlocal enabledelayedexpansion
set "params="
for /f "usebackq delims=" %%a in ("params.txt") do set "params=!params! %%a"
myCustomCmd %params%

That should fix the problem - in the absence of an example params.txt file.

Magoo
  • 77,302
  • 8
  • 62
  • 84