|
Answer» Hello, I need help to write a Dos apply. I have a folder "A" containing several files of which I don’t know neither the name nor quantity. I want to take each files to check them with a programme and send the each result in a file in the folder”B” I need a PROGRAM which will read the names of the files in the folder “A”, which will send the name of 1st of these files in a line a dos command (it would have to be put has 2 places: on the address of the folder “A” and on the address of a folder ”B”). And then this program have to start again until all the files of the folder “A” are treated. If you have ideas that could help me thanks to communicate them. Providing your program will read arguments from the command line, you can construct a loop using a FOR statement and key off a directory list of Folder A.
Personally I would write a script.
Hope this helps. I have some files in a folder D:\...\Tempdonnees, I want to check all these files with QChecker so I can do: D:\...\qcheckerV5.vbs -b -i D:\...\Tempdonnees\file1.txt -o D:\...\Tempresults\file1.txt but I don't know the names of these files (like file1) So write a cmd: for %%i in (D:\...\TEMPdonnees/*.txt) do C:\...\qcheckerV5.vbs -b -i D:\...\TEMPdonnees/%%ni%%~xi –o D:\...\TEMPresults/%%ni%%~xi
Is there an error?
I GUESS I'm from the old school, but batch language is cryptic enough without making it totally unreadable.
Code: [SELECT] for /f "tokens=1-2 delims=." %%a in ('dir /b /o *.txt') do ( QcheckerV5.vbs -b -i %%a.%%b -o %%a.%%b )
You can fill in the path names.
Now it's my turn to ask a question. If your batch file is calling a script (qcheckerv5.vbs), why not just modify the qchecker script to loop thru the file names?
Just a thought. Where can I fill the path name in this code?
And now for your question it's a good idea! I had no thought to this possibility I will try to modify the script.. but I m a begginer in informatic and this script seems to be difficult to understandI write this script:
for %%i in (D:\.../*.txt) do C:\...\qcheckerV5.vbs -b -i D:\...\TEMPdonnees/%%~ni%%~xi –o D:\...\TEMPresults/%%~ni%%~xi
and I ve a probleme all my outputfiles are CREATE in the same file so they are all erase except the last one. This file haven’t the name I want (it’s called QChecker.out) and it isn’t create where I want (it is on the deskwork) Code: [Select] for /f "tokens=1-2 delims=." %%i in ('dir /b /-o D:\...\*.txt') do ( C:\...\qcheckerV5.vbs -b -i D:\...\TEMPdonnees\%%i.%%j –o D:\...\TEMPresults\%%i.out )
All your output files will be in D...\Tempresults with a 'out' extension. Change it if you want. I'm sure there are uses for ~ni and ~xi but this is not one of them.
Try to use the best tool for the job. Thanks for your help my script managed thanks a lot
|