简体   繁体   中英

Directing output of file to txt file using cmd prompt script and java program

Hey I know there are other questions like this but I am puzzled as to how I can do this the way I want. I want to run my program that basically does something with the given input value then outputs the time it took to do this in ms to a Text File. I want to do this for value starting at 10,000 and incrementing by 10,000 until 200,000 and output the value to a TXT File. Like this

for (int i = 10000; i < 200000; i+=10000){
     print i
     java Program i > results.txt
}

So out put printed to the text file would be something like:

10000    30ms
20000    56ms
30000    75ms
etc      etc

Any help would be greatly appreciated, thanks in advance

I think, you mean this:

@echo off
(for /l %%i in (10000,10000,200000) do "my Java program" %%i)>"results.txt"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM