Solved

How could I execute a dynamic windows command with parameters?

  • 27 November 2020
  • 1 reply
  • 83 views

Userlevel 4
Badge +14

I have a little C# executable to be able to print Brother labels. I use a task (type windows command)  with parameters to execute it. This works fine if I use a fixed object name for the task. 

But now I want to be able to execute the C# executable based on the environment (DTAP). I tried this using an object name [task_name] filled as parameter in the default procedure.

This works if I only fill the path to the C# executable, but the other parameters are ignored (as described in the documentation). 

If I also add the values of other parameters to the object name parameter [task_name], I get the message ‘The system cannot find specified file’. If I use the same command string in Windows Command, it works as expected. 

How could I achieve this in the SF?

Could the environment automatically be replaced base on an environment variable (%environment%)?               

Are there better ways to solve this DTAP issues with external objects? 

icon

Best answer by Mark Jongeling 7 December 2020, 09:14

View original

This topic has been closed for comments

1 reply

Userlevel 7
Badge +23

Hi Andre,

It is indeed not possible to use parameters when combining it with an object name like [task_name]. The message ‘The system cannot find specified file’ will appear if you try to add parameters to that.

The only current way out of this is by creating a batch file (.bat) that calls the correct executable. In the batch file you can use parameters and if the batch file's name stays the same, you can connect parameters from the application with the batch file. 

Kind regards,
Mark Jongeling