Reputation: 193
I met one problem that is I can't print whatever "println" inside java to a .txt file. All I get is an empty .txt file.
Here is the code. Any changes that I need to make this code works?
start cmd /c java Lumi_FTP "C:\Users\310152922\Desktop\Mohit_Task\AutomatedScript\3535-2D\lumi_ftp_3535-2D_settings_CW0%week%.ini" >"C:\test\Scriptlogs\3535-2D\log_DP_%fullstamp%_CW0%week%.txt"
Thanks for reviewing, comments and answers.
Upvotes: 1
Views: 101
Reputation: 40356
From https://superuser.com/questions/338277/windows-cmd-batch-start-and-output-redirection:
Replace >
with ^>
, e.g.:
start cmd /c java Lumi_FTP "C:\Users\310152922\Desktop\Mohit_Task\AutomatedScript\3535-2D\lumi_ftp_3535-2D_settings_CW0%week%.ini" ^> "C:\test\Scriptlogs\3535-2D\log_DP_%fullstamp%_CW0%week%.txt"
This happens for reasons I do not fully understand. I believe it escapes the >
so that it applies to start
instead of being part of the command string.
You could also not use start
, but that may not be appropriate for your situation.
This is not related to the use of java
.
Upvotes: 1