Here is what you need:
first.cmd:
@echo off
set maincommand=echo hello world!
call test.cmd %maincommand%
test.cmd:
@echo off
%*
In this case, it first.cmdpasses a valid command (your example just passed the string constant "maincommand", not its value).
In addition, it test.cmdexecutes a command consisting of each parameter, and not just the first.
When you create these two files and execute first.cmd, you get:
hello world!
as was expected.
source
share