Skip to main content

I would like to run a simple command-line command in FME and output the text to an excel table.

I want to run

taslklist /s SERVERNAME /fi "ArcSOC*" > c:tasklist.txt

...and then send the results into other transformers.

How would I do this?

Yes, the SystemCaller will do that


Yes, the SystemCaller will do that

Agree. The SystemCaller can be used here effectively.

 

Just be aware that the SystemCaller itself won't read the file created by the command. If you intend to use contents of the text file written by the command in the subsequent processes in the workspace, you will have to write the result into a temporary file then read back it with another transformer, such as the AttributeFileReader or the FeatureReader.

 

The TempPathnameCreator is convenient to create a temporary file path.

 

 


thanks for the advice. I am having trouble creating the temporary file to store the results of the commandline command. I have created a TempPathCreator and see that the attribute has been filled with a path. How do I read the temporary file with the AttributeFileReader? I have set the Source Filename to the attribute Temppath from the TempPathCreator and changed the encoding to DOS Latin.-1 but nothing is read.


thanks for the advice. I am having trouble creating the temporary file to store the results of the commandline command. I have created a TempPathCreator and see that the attribute has been filled with a path. How do I read the temporary file with the AttributeFileReader? I have set the Source Filename to the attribute Temppath from the TempPathCreator and changed the encoding to DOS Latin.-1 but nothing is read. 

The TempPathnameCreator creates a temporary file path and save it into a feature attribute called "_pathname" by default, so you can construct the command line using the attribute value and set it to the SystemCaller. e.g.

 

"blablabla > "@Value(_pathname)""
You can then set "_pathname" to the "Source Filename" parameter in the subsequent AttributeFileReader to read the file.

 

If the file wasn't created anyway, set the "Exit Code Attribute" parameter in the SystemCaller to check if the exit code indicates 'success'.

 

Note: The temporary file will be removed automatically when the translation has completed. If you need to keep the file, specify an appropriate file path instead of the temporary file path. 

 

 


The TempPathnameCreator creates a temporary file path and save it into a feature attribute called "_pathname" by default, so you can construct the command line using the attribute value and set it to the SystemCaller. e.g.

 

"blablabla > "@Value(_pathname)""
You can then set "_pathname" to the "Source Filename" parameter in the subsequent AttributeFileReader to read the file.

 

If the file wasn't created anyway, set the "Exit Code Attribute" parameter in the SystemCaller to check if the exit code indicates 'success'.

 

Note: The temporary file will be removed automatically when the translation has completed. If you need to keep the file, specify an appropriate file path instead of the temporary file path. 

 

 

That worked super! thanks

 

 


Reply