Message to alert onlooker that the .bat file is still running

Regularly a .bat file is run at will by a user every day.  I would like some sort of a message that alerts the user that the routine is still running and not to interrupt it.  In other words, if the .bat file is still working away, the user should be alerted that the 'program' is still running and not to interrupt it etc.., and they should not have the ability, if a pop up message comes up or stays up to click on 'ok' and then the message disappears.  It needs to stay on the screen until the .bat file has run it's course, in it's entirety.  When the .bat file is finished, then the message should go away.  Perhaps a count down message would be good, if possible however the .bat file could take longer to run at different intervals so that may not be possible.  Regardless, a message should come up which does not interfere with the running of the commands in the .bat file, stay up during the entirety of the running of the .bat file and then it should disappear when the .bat file routine has totally finished.
100questionsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Smith and AndersenCommented:
add an echo line to your bat file saying.....bat file running and another when its done the routine saying finished
0
carcarahCommented:
Try Start command with parameters B and wait.
Read de help: start /?
0
Bill PrewCommented:
How is the batch file initiated?

Do you want them to still be able to do other work on the computer?

~bp
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

100questionsAuthor Commented:
I believe I start the batch file minimized, calling on another batch file.  
The batch file should stay minimized, however I want the notification pop up message to be visible to the user throughout until the batch file has completed running it's tasks.
0
Bill PrewCommented:
There are not a lot of good options for doing this from a batch script without using third party utilities, etc.  Why not just run the BAT file not minimized (visible), and at the head of the BAT script do something like:

@echo off
cls
echo ****************************************
echo ****************************************
echo ****     BATCH PROCESS RUNNING      ****
echo ****            DO NOT END          ****
echo ****************************************
echo ****************************************

Open in new window

~bp
0
100questionsAuthor Commented:
@billprew -- Is there a way to run the .bat file silently and yet see a message like the one you posted?
0
carcarahCommented:
I think you have to redirect program's output to a file.
ex.:

@echo off

echo Processing first step, don't stop me now.

start /wait /b Program_process1 > process.log

echo Processing second step, rock'n'roll!

Rem Use >> to append  results. only one > sign would rewrite log file

start /wait /b Program_process2 >> process.log

echo Process done
0
Bill PrewCommented:
@billprew -- Is there a way to run the .bat file silently and yet see a message like the one you posted?
Okay, here's a small example that demonstrates the approach you could talk.  Here's two sample bat files, one is the little "popup message" an the other would be your existing bat job that runs.

Save these off with the names shown below in a test folder, and from a command prompt in that folder do this command to simulate a test.  Let me know what you think...

start /min j.bat

m.bat
@echo off
cls
echo ****************************************
echo ****************************************
echo ****     BATCH PROCESS RUNNING      ****
echo ****            DO NOT END          ****
echo ****************************************
echo ****************************************
pause
exit

Open in new window

j.bat
@echo off
REM Launch the message "window"
start "** RUNNING **" m.bat

REM Job processing logic here (5 second delay here for testing)
ping -n 1 -w 5000 192.0.0.0 >NUL 2>&1

REM Find and kill the message proc
for /f "tokens=2 delims=," %%A in ('tasklist /v /fo csv ^| find "** RUNNING **"') do (
  taskkill /pid %%~A > nul
)

exit

Open in new window

~bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
100questionsAuthor Commented:
@billprew --   in j.bat can I go ahead and actually remove the ping line after testing?  Also, can we not have it ping the machine itself that it's running on instead of 192.0.0.0 ?
0
100questionsAuthor Commented:
@carcarah --  the last example you posted, how would this produce a message to the user that a batch file is running and not to interrupt it?
0
Bill PrewCommented:
@billprew --   in j.bat can I go ahead and actually remove the ping line after testing?  Also, can we not have it ping the machine itself that it's running on instead of 192.0.0.0 ?
The PING was purely for example purpose, an easy way to introduce a 5 second delay so that you sould see the popped up message during this small test.  In your real world case that would be replaced by whatever logic is currently in your existing job.

~bp
0
carcarahCommented:
@100questions Well, there is no an easy solution to do this.

 The message will appear and the batch will not interrupt on the start command,, but it is possible between these steps.

The @billprew solution is nice, however don't protect process too.
I used the billprew's script (don't you mind Bill?) and created a possible solution.

Test it

process.bat

@echo off
REM Start start_process.bat minimized 
start /min start_process.bat

Open in new window

start_process.bat

@echo off

Echo Process Started > process.log 

REM Launch the message "window"
start "** RUNNING **" m.bat

Echo Message launched >> process.log 

REM Job processing logic here (5 second delay here for testing)
ping -n 1 -w 5000 192.0.0.0 >NUL 2>&1

Echo Process done >> process.log 

REM Find and kill the message proc
for /f "tokens=2 delims=," %%A in ('tasklist /v /fo csv ^| find "** RUNNING **"') do (
  taskkill /pid %%~A > nul
)
Echo Message killed >> process.log 

exit

Open in new window

m.bat

@echo off
cls
echo *******************************************
echo *******************************************
echo ****                                   ****
echo ****      Batch process running        ****
echo ****                                   ****
echo ****             DO NOT END            ****
echo ****                                   ****
echo ****    DO NOT CLOSE THIS WINDOWS      ****
echo ****                                   ****
echo ****     When this windows closes      ****
echo ****     the process will be done      ****
echo ****  and you can check the log file   ****
echo ****                                   ****
echo *******************************************
echo *******************************************
pause
exit

Open in new window

0
100questionsAuthor Commented:
@billprew --  the problem with this script is that after displaying not to close the window it says Press any key to continue...
0
carcarahCommented:
It's easy 100questions, change pause command in m.bat to  

pause > null

Open in new window

0
Bill PrewCommented:
@carcarah

Not sure what you mean by "don't protect process too"?

It looks like all you did was add some logging to the main script, and change the text displayed in the message box?

~bp
0
carcarahCommented:
Not sure what you mean by "don't protect process too"? billprew

The script opens a new windows with a message, but the could close the main window stoping the process.

It looks like all you did was add some logging to the main script, and change the text displayed in the message box? billprew
Yeap, but I also hid the main (start /min start_process.bat]) process to prevent someone close it.

Try a test: start your script with a 30 seconds ping delay and close de first window. The message window never will be closed.
0
Bill PrewCommented:
Right, but the OP indicated they were already running the first script minimized, so mno need to introduce another script on top of that.

~bp
0
carcarahCommented:
ok, it escapes me
0
Bill PrewCommented:
Thanks, glad that helped.

~bp
0
BillDLCommented:
I realise that this question is closed, and I am just posting something that may be of interest to you or anyone finding this question later.  In VBScripting you can show a message box, and you can set its "modality" to "vbSystemModal" rather than to the default "vbApplicationModal", and this forces the message box to stay on top of other windows.

In the basic example the batch file starts a lengthy process (directory listing of folders on the C: drive) and then starts a VBScript message box which remains on top of the "DOS" window.  Even if the message box window is closed with the "x" or the "OK" button, the original batch process will continue uninterrupted.

IMPORTANT.VBS

x=MsgBox("VERY IMPORTANT BATCH FILE RUNNING!" & vbCrLf & vbCrLf & "Please do not tinker with the process.",0+64+0+4096,"WARNING")

Called from batch file named whatever you want

@echo off
start /b dir /on /ad /b /s "C:\*.*"
start /b cscript //nologo IMPORTANT.vbs
pause


VBS MsgBox parameters:

MsgBox(prompt[,buttons][,title][,helpfile,context])

"Buttons" parameter = value or sum of values from each separate group

Button Display
0 = vbOKOnly - OK button only
1 = vbOKCancel - OK and Cancel buttons
2 = vbAbortRetryIgnore - Abort, Retry, and Ignore buttons
3 = vbYesNoCancel - Yes, No, and Cancel buttons
4 = vbYesNo - Yes and No buttons
5 = vbRetryCancel - Retry and Cancel buttons

Icon To Display
16 = vbCritical - Critical Message icon
32 = vbQuestion - Warning Query icon
48 = vbExclamation - Warning Message icon
64 = vbInformation - Information Message icon

Button Behaviour
0 = vbDefaultButton1 - First button is default
256 = vbDefaultButton2 - Second button is default
512 = vbDefaultButton3 - Third button is default
768 = vbDefaultButton4 - Fourth button is default

Modality
0 = vbApplicationModal
4096 = vbSystemModal

The prompt is the text that appears in the window of the message box. Each & vbCrLf forces a new line.

If no Title is specified, the name of the VBS file is shown in the title bar of the message box.

Help File and Context are not really applicable here.  It is the vbSystemModal value (4096 in the script) that is important, because it forces the message box to stay on top of other windows.
0
100questionsAuthor Commented:
@BillDL --  Thanks very much for the extra information.
0
Bill PrewCommented:
@BillDL,

Good info Bill.  I had thought about going the VBS route for the message box part of things, especially since BAT really has no "message box" capability.  I had also considered third party addon utils as well as IE.

The issue I had with the VBS message box, was the inability to remove all buttons from the pop up window.  Having any botton on the pop up, whether "Okay" or "Cancel" etc seemed to be encouraging the viewer to click the button, and that was the effect the OP was trying to avoid.

Not taking anything away from your valid alternative, just collaborating on why I went with the somewhat cruder DOS box approach.

~bp
0
BillDLCommented:
Hi Bill.

When I first saw the question, my first instinct was to use the:
MODE CON: COLS=xx LINES=yy
and
COLOR XY
commands to create a small but obvious window that didn't look like a "DOS" one, but decided that a VBS one made to "stay on top" might look more business-like and serve the purpose better.

I wondered why you apparently hadn't considered VBS amongst your range of options though.  I'm glad you don't know of a way to hide all buttons, including the standard "OK" one, because I was sure that I was missing something when I tried to figure out how.  I was trying to use Abort, Retry, Ignore, to hide the first two, and set Ignore to "do nothing", but gave up.

If I knew enough about HTA I might have tried that instead.

When you explain it so, I can understand how a button would probably be an inducement to many users to click on it, especially in these click-happy days of "facebooking" where users just click without thinking.  It would probably just look like yet another "like" button to many.    What would the masses do?
0
100questionsAuthor Commented:
@carcarah --  the problem with this script is that after displaying not to close the window it says Press any key to continue...

where do I insert pause >null ?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.