First, I apologize for posting this since it seems to have been addressed for every situation except mine (or so I can find), and I admit I am a complete novice.

Intro: I have a batch file which gets placed in a directory with target files, loops through the files in the directory, converting them using another program, and moves the output to a dated subdir. Each conversion takes about 30 minutes. The unfinished output file sometimes changes size as it is being converted, but this is quite slow.

Need: Some sort of progress or activity bar to indicate something is happening (for the users who like to close the window thinking its not working).

Current Batch file:
This converts all .mgf files in a directory, places them in a dated sub-dir and after a pause will delete the batch file. This is made for end-users who are a bit click happy.

Set CURRENTDIR=%CD%
Set mm=%date:~4,2%
Set dd=%date:~7,2%
Set yyyy=%date:~10,4%
Mkdir "%yyyy%-%mm%-%dd% MGFs"
for /f "delims=" %%a IN ('dir /b *.wiff') do (
	cd "C:\Program Files (x86)\AB SCIEX\MS Data Converter"
	AB_SCIEX_MS_Converter WIFF "%CURRENTDIR%\%%~na.wiff" -proteinpilot MGF "%CURRENTDIR%\%yyyy%-%mm%-%dd% MGFs\%%~na.mgf"
)
pause
@echo off
start /min cmd /c del /q %~s0
goto :eof

Idea: Put the following somewhere, except I can't get that to work within the for/do structure.

Print var+5 "%" 
Pause 500

Edited 5 Years Ago by neely615: n/a

lose the pause, and print the progress indicator at the bottom of the for loop. If that's too fast, keep a counter and print only on every Nth pass through the loop. You don't get a nice steady progression (assuming that the conversions are not equally lengthy), but you do get something that is at least a little bit useful. If you can figure out how, print <space> outside of the loop, then print <backspace>spinner where spinner is an array of these characters: |/-\

Comments
nice

The only problem is each conversion takes about 30 minutes, so it won't move from the convert line AB_SCIEX_MS_Converter...%%~na.mgf until its finished. Is there any way to run the print command in parallel to the convert command? Maybe I could minimize the main window and for each file just have a dummy window pop up with a staggered print, and then somehow close it before moving to the next file?

Again, I have no clue, but thanks for the suggestion.

I'm absolutely not a windows guy, but I've seen progress bars on installation tools that have to be running in parallel to the installation (I guess). How about at the top of the loop you fire off a little window with a spinner or barberpole or something and a (guess) as the to time remaining. Make it big, but count it down. Then if there is still some time remaining when you get to the bottom of the loop and close it, people are happy. If it sits there with negative time remaining, people worry.

Now: "Fire off a little window" is all you have to figure out how to do, eh? Yeah, you could minimize the command window, if you can figure out how. Maybe if you wrap the whole thing in a GUI, then you can just draw the count-down over the top of it?

If the conversion process has a loop in it somewhere, you could send some information back at the bottom of that loop to use for a count-down graphic. I'm just muttering and waving my hands here...

If each file is taking up to 30 minutes, and you have lots of files, then the total run time is going to be many hours, possibly an overnight job, or even days.

Why do you need a per-second update of progress?

Or why do you have so much "free" time to care about looking at the progress so often of a process which is going to take a long time.

If each file is taking up to 30 minutes, and you have lots of files, then the total run time is going to be many hours, possibly an overnight job, or even days.

Why do you need a per-second update of progress?

Or why do you have so much "free" time to care about looking at the progress so often of a process which is going to take a long time.

Its actually not for me, but for people that come in and want to know whether it is 'moving.' At one time only 6-8 files (or less are being converted) so at times it is merely popping your head in to check out where it is. Currently it just moves through the files, and I was just figuring out if I could have some random progress bar to indicate its doing something. An easy way to make people patiently wait versus close the window and find me to tell me it wasn't working.

It may be more trouble than its worth.


It may be more trouble than its worth.

The sign of an intelligent IT person ;)

From time to time, I've found myself writing a variant on this:


At the top of every loop,

print <<the description of what will be handled>>
<<calculate the finish time?>>
print %currenttime%
print "******"
print "THIS WILL TAKE ABOUT 30 minutes <<and finish at approximately %finishtime%>>
print "******"
print ""
print "--------------------------------"
print "!!! DO NOT CLOSE THIS WINDOW !!!"
print "--------------------------------"
print ""
print "******"

At the bottom of every loop, print the description of what was just handled

At the end of the program,

print ""
print "OK, we're done now. Thanks for your patience"
print ""
This article has been dead for over six months. Start a new discussion instead.