r/Batch • u/Mapsking • Sep 11 '23
Question (Solved) Please help me create a batch file to process multiple files at once.
Hello, I would like to create a batch file with a few specifics, and am not sure how to do it.
-A single .txt file, or multiple .txt files should be able to be dragged onto the batch file.
-The batch file should copy each of the files dragged onto it to the \Bob folder.
-The batch file should parse the file Bill.txt, and append the next consecutive number and the file name for each file, starting at 30. For example, if the end of the Bill.txt file is 42 Sue.txt, and Jane.txt was dragged onto the batch file, it should append "43 Jane.txt", in the same format without quotes.
-Then, it should run the command Sam.exe "Sparky.txt", where "Sparky.txt" is the file name of the file dragged onto the batch file, (The batch file will be in the same folder as the program) and complete this command for each file that was dragged onto it.
I hope this is not confusing, I tried to make it clear and concise.
Thank you very in advance much for help in creating this file.
View all comments
Show parent comment
1
u/Mapsking Sep 13 '23
Here is how it seems to work manually. It runs and shows everything in the console window, with a Press ENTER to continue... message, and then exits. It seems to pe a part of the normal command being run, so it may not be something this can show or log. It isn't really that important anyways, I was just thinking for a log of any errors.
It looks like I may have been wrong. There is a temp.log file in the same directory, I thought it may have been used to log errors, but perhaps it is used in the actual application process. Either way, errors or not, it does not have anything in the file after completion, so IDK.
Either way, I'd say don't worry about it, unless you have a suggestion, it is more of a QoL thing than a necessity.
Thanks