Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

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
Labels (2)
8 Replies
Anonymous
Not applicable

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,
_AnonymousUser
Specialist III
Specialist III
Author

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
_AnonymousUser
Specialist III
Specialist III
Author

OK, solved. Just replace sinlge quotes with \"
Magi
_AnonymousUser
Specialist III
Specialist III
Author

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
Anonymous
Not applicable

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... ; -)
_AnonymousUser
Specialist III
Specialist III
Author

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
Anonymous
Not applicable

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.
Anonymous
Not applicable

"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?