Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Debug tSystem using "cmd"

I'm trying to debug a tSystem component, one which begins with "cmd. Is there a way to access the output from this? Non-echo system calls (e.g., echo hello) do print to console, but adding "cmd" takes this behavior away. For instance, if you pass tSystem the string "cmd aadsfa", the component runs normally without any (error) output.

Labels (2)
1 Reply
Jesperrekuh
Specialist
Specialist

Redirect output to a file or to an environment variable.
"cmd /c dir *.* > allfiles.txt"

You need to distinct between "two" levels of error...
1 : like you pass within tSystem and an unknown command.
example :
"woop /K dir *.*"
Cannot run program "woop": CreateProcess error=2, The system cannot find the file specified

2: a false cmd which your cmd environment o.s. shell is not able to run:
"cmd /K dirme *.*"
'dirme' is not recognized as an internal or external command, operable program or batch file.

You probably want the error in example 2? however an exit code isn't always used by programs or batch scripts so I suggest redirecting out put to logfile or to an environment variable.

Take a look at this:
https://support.microsoft.com/en-us/help/110930/redirecting-error-messages-from-command-prompt-stder...