I am trying to execute a series of commands in a cmd.exe
shell from within Java and pipe the output of these commands to a file. Here is the code I've written:
Process process = rt.exec("cmd /c start cmd.exe /K \"cd C:\\Temenos\\ModelBank-R15-TAFJ\\T24\\Env\\MB\\Agents && C: && Environment.bat && DBTools JQL LIST-ITEM F.SPF \">D:\\test.txt \"");
If I run DBTools JQL LIST-ITEM F.SPF
, I can see output on the console, but I want to save the output to a file. When I add > D:\\test.txt
, I see that a test.txt
file is created in D:\
, but it is blank.
Please if anyone can help me out in this, as this very crucial for my project.