I wrote a batch file that reads in a text file which contains a list of file name, and then delete and rename them one by one. I did this by using a for loop, and it works perfectly by double clicking it.
But when I tried to call this batch from a Java program. It's no longer working for this part:
for /f %%a in (ListFile.txt) do ( DEL %%a REN %%a_NEW %%~nxa )
If I only specify a certain file name. It's working by calling from Java. Say,
DEL tag.jar REN tag.jar_NEW tag.jar
The same thing happen for 'call' command. It's not working if calling from Java program, which makes me have to use 'start' command.
Can someone tell me why is it like this? How can I make it also working if calling from Java program?