1.

Solve : Batch popup message?

Answer»

Is there anyway to popup a message with a batch script where the user has to click OK for the batch file to run?

I current have it so that it pops up a message and the user has to click OK and then ENTER in the command prompt but this is a problem because the command prompt gets hidden behind another active window. Any help is appreciated.

============================================================
msg %username% Click OK and then Enter to start backup.
pause
============================================================

Also, if you can tell me if the following script can be shortened or rewritten so it is closer to scripting standards, that woudl be great.

==========================================================
msg %username% Click OK and then Enter to start backing up your OUTLOOK Email

pause

if not exist "c:\Documents and Settings\%username%\My Documents\Outlook Backup\null" mkdir "c:\Documents and Settings\%

username%\My Documents\Outlook Backup"

if not exist "c:\Documents and Settings\%username%\My Documents\Outlook Backup\Archive\null" mkdir "c:\Documents and

Settings\%username%\My Documents\Outlook Backup\Archive"

xcopy "c:\Documents and Settings\%username%\My Documents\Outlook Backup\Current" "c:\Documents and Settings\%username%\My

Documents\Outlook Backup\Archive" /d/e/c/q/h/r/y

rmdir /S/Q "C:\Documents and Settings\%username%\My Documents\Outlook Backup\Current"

if not exist "c:\Documents and Settings\%username%\My Documents\Outlook Backup\Current\null" mkdir "c:\Documents and

Settings\%username%\My Documents\Outlook Backup\Current"

if "%TODAYDATE%"=="" set TODAYDATE=%date:~4,2%-%date:~7,2%-%date:~10,4%
if "%date:~2,1%"=="/" set TODAYDATE=%date:~0,2%-%date:~3,2%-%date:~6,4%

mkdir "c:\Documents and Settings\%username%\My Documents\Outlook Backup\Current\%todaydate%"

taskkill /IM outlook.exe

ping -n 60 127.0.0.1>nul

xcopy "c:\documents and settings\%username%\local settings\application data\microsoft\outlook" "c:\Documents and Settings\%

username%\My Documents\Outlook Backup\Current\%todaydate%" /d/e/c/q/h/r/y

for /f %%i in ('date /t') do (
if %%i==Fri if exist "c:\Documents and Settings\%username%\My Documents\Outlook Backup\Current\**-**-****" rmdir /S/Q

"C:\Documents and Settings\%username%\My Documents\Outlook Backup\Archive\"
)
msg %username% The backup has completed. Click OK to close.
============================================================You could try using the msg command with the /time:xx and the /W switches. Used correctly you can eliminate the pause with it's additional interrupt to the console.

Batch files? Standards? You're KIDDING, right? Writing batch language has been an exercise in spaghetti code since 1980. If your code WORKS, don't mess with it.

8-)Thanks for the help...the "msg /W" works great.



Discussion

No Comment Found