One Star

tSystem with parameters

Hi,
I am trying to execute a program for all files in a filelist.
My tSystem command should be something like:

"cmd /c cd 'C:/Program Files/test' testprogram 'D:/Data/References/test.txt' ((String)globalMap.get('tFileList_1_CURRENT_FILEPATH'))"

My testprogram needs two parameters. The first one is a known file 'D:/Data/References/test.txt' and the second one is the filename that comes from tFileList_1. The error that I get when I run this is

The filename, directory name, or volume label syntax is incorrect.
Obviously one of the filenames is not interpreted properly. Can you plese help me with this?
Thanks
Magi
8 REPLIES
Employee

Re: tSystem with parameters

I think that you can test :
"cmd /c C:/Program Files/test/testprogram 'D:/Data/References/test.txt' '"+((String)globalMap.get('tFileList_1_CURRENT_FILEPATH'))+"'"
Regards,
One Star

Re: tSystem with parameters

Thank you. It is getting better, but I still have problems when my folder names have spaces. From a cmd double quotes usually do the trick, but in TOS when I use double instead of single quotes I am getting compilation errors
Can you plese advise how to bypass this problem?
Thanks
Magi
One Star

Re: tSystem with parameters

OK, solved. Just replace sinlge quotes with \"
Magi
One Star

Re: tSystem with parameters

Hi,
Moving on, I would like to now redirect my output to a file. If I use

"cmd /c C:/Program Files/test/testprogram \"D:/Data/References/test.txt \""+((String)globalMap.get('tFileList_1_CURRENT_FILEPATH'))+"\" > \""+((String)globalMap.get('newPath')) + "\"",
the file doesn't get created.
I have set up the output to be to a console, so I presume this should work, but it doesn't.
The output to a global doesnt work for me either because the program that I am running generates a string that should be saved as xml.

Any ideas?
Thanks
Magi
One Star

Re: tSystem with parameters

Hi magi,
I observed that with JAVA the pathnames including spaces are sometimes badly interpreted when they are placed in command parameters.
In my case, i installed the Talen environment in C:\Talend instead of C:\Program Files\Talend so that all functions well.
In any case, to create directories with empty or accentuated characters is not a good idea... ; -)
One Star

Re: tSystem with parameters

Thanks. I am afraid I don't have a choice as I receive huge volumes of data saved exactly in those kind of directory names. Renaming the folders is completely unnecessary and error prone. Nevertheless, that is already solved.

My new problem is that I want to redirect my output to a file and using the standard cmd redirection doesn't work with tSystem. I would appereciate advise on this issue.
Thanks
Magi
One Star

Re: tSystem with parameters

I am having the same problem with Unix redirect '>'. tSystem does not recognize it. Possible bug? are there any other alternative way to to redirect? Thanks.

Re: tSystem with parameters

"bump" on this five year old post. . .
I want to send teh output of svndump to a file.
tystem can send output to console, but not directly to a file.
It does have a "normal" output, docs: "normal: data is passed on to the component that comes next."
So maybe having the output go to tFileOutputDelimited works, setting the delimiter to nothing, and sending out one big string of data?