|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi there,
ANYONE WHO KNOWS HOW TO IMPLEMENT A TIMER IN A BATCH LIKE BELOW?? Don't know if this is right forum, but I guess that maybe you programmers know what I need. After reading a post about backup-files with a batch I immediately made something like it for myself. I always wanted that kind of script, but I'm not really a programmer and didn't know what batch-files were. This is what I just wrote: ---------------------------------------------------- @echo off :: variables set backupcmd=xcopy /s /c /d /h /i /r /k /y cls echo Backup-system BOOKMANAGER echo backing-up ... %backupcmd% C:\Inetpub\wwwroot\opa\Books.mdb Z:\backup\ echo Backup successfull! ---------------------------------------------------- Found out that without the "pause" tags the script runs immediately and closes after finish. But I'd like to make it that way so it holds at finish for about 4 seconds, and then shuts the script down. So that I'm able to read what's on the screen, without seeing it in a flash And also (if possible) when the drive doesn't exist (when usbstick ain't connected to pc) that it shows an error message like: FOUT! (which is Dutch for false) together with a message like: press spacebar to try again ... (so script runs again) Best regards, Bart Stens (newbie) |
|
#2
|
|||
|
|||
|
Hi,
Didn't find anything at the Microsoft website to make time-limited pauses into a batch file, so I didn't implement that one. ANYONE WHO KNOWS HOW TO IMPLEMENT A TIMER IN A BATCH LIKE BELOW?? Below is the batch, just try out. I've changed my Dutch words to English, and the lay-out with blank lines was just nice. Code:
@echo off
color 4f
:start
cls
echo.
echo ***********************************************
echo.
echo Backup-system EXLIBRIS Stensol - BOOKCATALOG
echo.
echo ***********************************************
echo.
echo.
echo.
echo writing backup of database ...
echo.
echo.
echo.
echo RESULT:
echo.
xcopy /s /c /d /h /i /r /k /y C:\Inetpub\wwwroot\Books.mdb Z:\backup\
if errorlevel 4 goto usb
if errorlevel 2 goto exit
if errorlevel 0 goto exit
:usb
echo.
echo.
echo.
echo ^>^> WARNING: please insert usb-stick into laptop! ^<^<
echo.
echo.
echo.
echo.
echo.
echo.
pause
goto start
:exit
echo.
echo.
echo.
echo ^>^> Backup successfully updated on USB-stick ^<^<
echo.
echo.
echo.
echo.
echo.
@pause
Best regards, Bart Stens |
|
#3
|
|||
|
|||
|
There are probably some timer programs floating around that could do what you want.
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#4
|
|||
|
|||
|
Yeah, but I really don't have any idea where to find or how to implement for that batch-file.
Regards, Bart |
|
#5
|
|||
|
|||
|
Try this google search
http://www.google.com/search?q=dos+batch+timer&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US fficial |
|
#6
|
|||
|
|||
|
Thanx for tip, tried all Google-results, and as I mentioned before: I'm not a professional-scripter, so it was hard for me to find something usefull.
Found functions and commands like TIMER START,PAUSE,STOP. and SLEEP etc. But nothing seemed to help. Thought that "SLEEP 5" would pause down the script for 5 secs, before exit the batch-window. Didn't work at all, but needed to download a .exe-file called "sleep" and that solved the problem, now it works perfect! Thanx for help everyone! Regards, Bart Stens |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > batch-file xcopy @pause (with 4 secs. delay) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|