Lu Topic Starter
Posts: 3
|
 |
« on: August 20, 2009, 08:48:22 AM » |
|
Hello,
I'm trying process text files from directory, but i do something in wrong way.
@echo off for %%i IN ('D:\txts\*.txt') do java -jar D:\java\somefile.jar -i < %%i > %i_done.txt It should look like this:
java -jar D:\java\somefile.jar -i inputfile.txt > output_done_file.txt But, of course it doesn't work it that way. What i do wrong?
|
|
|
|
« Last Edit: August 21, 2009, 02:25:30 AM by Lu »
|
IP logged
|
|
|
|
|
|
smeezekitty
Thanked: 44 Posts: 0
|
 |
« Reply #2 on: August 20, 2009, 02:29:31 PM » |
|
%i_done.txt is suppose to make the original name plus _done.txt so hello_world.txt would become hello_world.txt_done.txt
|
Acer extensa 463oz 2 gb ram 160gb hdd 2ghz processor and desk fan sitting next to it for cooling 
|
|
|
|
|
smeezekitty
Thanked: 44 Posts: 0
|
 |
« Reply #4 on: August 20, 2009, 03:34:10 PM » |
|
that would be an error
|
Acer extensa 463oz 2 gb ram 160gb hdd 2ghz processor and desk fan sitting next to it for cooling 
|
|
|
|
|
Lu Topic Starter
Posts: 3
|
 |
« Reply #6 on: August 21, 2009, 12:17:55 AM » |
|
I try to achieve such goal:
Take all text files from input directory and let some java program do it's work. But this program must have defined in and out. It works fine with commands:
java -jar somefile.jar -i C:\input_dir\file1.txt -o C:\output_dir\file_done.txt java -jar somefile.jar -i C:\input_dir\file1.txt > C:\output_dir\file_done.txtI cannot do:
java -jar somefile.jar -i C:\input_dir\*.txtbecause output is not specified or produces 0 byte output for *.txt which for me it's useless. I need put processed files into different directory with maybe changed names. Does the closing parenthesis means:
(java -jar D:\java\somefile.jar -i %%i -o %%i_done.txt) I guess not...
|
|
|
|
|
smeezekitty
Thanked: 44 Posts: 0
|
 |
« Reply #7 on: August 21, 2009, 12:36:50 AM » |
|
did it work or not? i am confused 
|
Acer extensa 463oz 2 gb ram 160gb hdd 2ghz processor and desk fan sitting next to it for cooling 
|
|
|
Lu Topic Starter
Posts: 3
|
 |
« Reply #8 on: August 21, 2009, 02:24:47 AM » |
|
Well, the only thing that works is command in cmd:
for %i in (c:\input\*.txt) do java -jar somefile.jar -i %i > %i_done.txtBut if it works in cmd i don't care how to write it in batch file - thanks for all replies.
|
|
|
|
|
Helpmeh
Thanked: 117 Posts: 3,608
Experience: Experienced OS: Windows XP

Roar.
|
 |
« Reply #9 on: August 23, 2009, 07:56:58 PM » |
|
Well, the only thing that works is command in cmd:
for %i in (c:\input\*.txt) do java -jar somefile.jar -i %i > %i_done.txtBut if it works in cmd i don't care how to write it in batch file - thanks for all replies.
Take your code, add @echo off on a line above it and paste it into notepad. Save it as myscript.bat and there you go!
|
Where's MagicSpeed? He's playing a game called IRL. Great graphics, *censored* gameplay.
|
|
|
|
|