Page 1 of 1

Passing TI Parameters to a DOS .cmd file

Posted: Tue Jun 24, 2008 6:26 pm
by kielmc
Is it possible to pass TI Parameter variables to a dos batch file?

I can call a DOS batch file using the following:

ExecuteCommand('C:\test.cmd', 1);

and everything works fine. However, if I try to add parameters, the .cmd file won't run...

ExecuteCommand('C:\test.cmd p1 p2', 1);

any thoughts?

thanks!

Re: Passing TI Parameters to a DOS .cmd file

Posted: Tue Jun 24, 2008 8:00 pm
by Mike Cowie
Hi,

Have you looked at the TI EXPAND function? It takes a string containing references to TI variables (which parameters are) and "expands" the contents of the variable into the string. So, using your example:

Code: Select all

ExecuteCommand(EXPAND( 'C:\test.cmd %p1% %p2%' ), 1);
Here I'm assuming that you have 2 TI parameters (both String type) called p1 and p2.

As far as how it works, let's say you have the following values:
  • p1=Hello
  • p2=World
When the TI process runs the ExecuteCommand will effectively get this command string passed into it:

Code: Select all

ExecuteCommand('C:\test.cmd Hello World', 1);
Hope that helps.

Regards,

Re: Passing TI Parameters to a DOS .cmd file

Posted: Tue Jun 24, 2008 8:53 pm
by kielmc
Thanks Mike, that function is exactly what I'm looking for!