I think I may have the solution:
Depending on what the content of the message box, I may be able to help with that part of it - if it simply states some text, with an OK, or a Yes/No button/s, then I can do that.
What I propose is to create one batch file, to do all the operations you listed.
This way, you can define the order, however you like. And you know that one task cannot run until the other is completed.
The code for the question box varies a lot, depending on what sort of box you're after. The code itself is quite simple and only a couple of lines, once you've decided on what sort of message box you're looking for.
Here's the code for the message box (hopefully it's what you're after):
echo wscript.quit MsgBox ("Message", Number, "Title") > message.vbs
wscript //nologo message.vbs
set value=%errorlevel%
del message.vbs
if "%value%"=="1" goto :ok
if "%value%"=="2" goto :cancel
if "%value%"=="3" goto :abort
if "%value%"=="4" goto :retry
if "%value%"=="5" goto :ignore
if "%value%"=="6" goto :yes
if "%value%"=="7" goto :no
Obviously, you replace the Message with the content of the message box, the Title with the title, and the Number with one of the the numbers documented below. Make sure you include the quotation marks where necessary (where they already are in the code above).
Number (defines the buttons in the message box):
- If 1, then you get a message box with OK, and Cancel
- If 2, then you get a message box with Abort, Retry and Ignore
- If 3, then you get a message box with Yes, No and Cancel
- If 4, then you get a message box with Yes and No
- If 5, then you get a message box with Retry and Cancel
- If 6 and above, you get the same result as 1. (99% sure)
The %value%
variable gives a numerical representation of what button you pressed. In the code I listed above, I documented each outcome, in the form of a piece of code that goes to a location in the batch script, titled that. I trust you understand locations, defined by :example
, where example
is the name of the location. This means that where it says goto :ok
, there is a location called :ok
in your batch script, where the corresponding code is stored for that outcome. Of course, you don't have to have the goto
command at the end of the if statement if you don't want, I just included that, as an easy way to distinguish which value, corresponded to which button.
After the message box in your batch script, you'd have your backup program. Following that, your shutdown command (shutdown -s I presume?)
That's it! All you need to do now, is make a task in Task Scheduler, to run the batch file, and Voila! You should have a message box, backup, and shutdown, executed consecutively.
Just some feedback: I'm guessing the reason this got a downvote (if you can't access the detail, it got 1 downvote + 1 upvote), is that you didn't include the batch file. So there was nothing specific for people to respond to. Then you self-answered, but there was no context to understand the solution. That limits the usefulness of both the question and answer in terms of its value to others, which affects voting. If you turn your posts into a "teachable moment", with good explanation on answers so people understand WHY it works, your posts willl attract a lot more upvotes. – fixer1234 – 2016-02-11T09:11:05.447