How do I get the output from a .bat using tSystem?

Nine Stars

How do I get the output from a .bat using tSystem?

I have a simple .bat job which prints the date time

@echo off echo %date:~10,4%-%date:~4,2%-%date:~7,2% %time:~0,2%:%time:~3,2%:%time:~6,2% exit;

 

I call the .bat job with tSystem component:

command "cmd /c start D:\\myDate.bat"

 

How do I write the returned date time to a file?

I tried all the Standard Output choices but every time a blank line is written to my output file.


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: How do I get the output from a .bat using tSystem?

Just to be sure, here is a capture of my tSystem component:

Capture.PNG

 

 


TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: How do I get the output from a .bat using tSystem?

In tSystem set "Standard Output" to "to Global variable".

Now the result is available from tSystem_2_OUTPUT (in tSystem name is tSystem_2).

You can easily put the result into a file using a tFixedInputFlow connected to a tFileOutputDelimited (for example).

Here is the tFixedInputFlow:Capture.PNG

Enjoy!

 


TRF
Nine Stars

Re: How do I get the output from a .bat using tSystem?

Starting a .bat in the Command of tSystem I wasn't able to get it to pass back the output of the .bat.

 

My job looks like: tSystem_1 onSubjobOk  tFixedFlowInput_1>tFileOutputDelimited_1.

 

Apparently the echo date time command must be in the Command of tSystem.

 

 

Fifteen Stars TRF
Fifteen Stars

Re: How do I get the output from a .bat using tSystem?

Not necessary. In the example I give, I used a command file, just removed the exit, the rest is copy/paste from your script.

TRF
Fifteen Stars TRF
Fifteen Stars

Re: How do I get the output from a .bat using tSystem?

Just to be sure, here is a capture of my tSystem component:

Capture.PNG

 

 


TRF

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads