Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 13th, 2005, 04:01 PM
stensol stensol is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Netherlands
Posts: 28 stensol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 10 sec
Reputation Power: 0
Question batch-file @pause (include a timer?)

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)

Reply With Quote
  #2  
Old January 14th, 2005, 08:25 AM
stensol stensol is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Netherlands
Posts: 28 stensol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 10 sec
Reputation Power: 0
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

Reply With Quote
  #3  
Old January 15th, 2005, 09:44 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 29 m 58 sec
Reputation Power: 181
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

Reply With Quote
  #4  
Old January 16th, 2005, 07:34 AM
stensol stensol is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Netherlands
Posts: 28 stensol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 10 sec
Reputation Power: 0
Yeah, but I really don't have any idea where to find or how to implement for that batch-file.

Regards,
Bart

Reply With Quote
  #5  
Old January 16th, 2005, 07:07 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 29 m 58 sec
Reputation Power: 181
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-USfficial

Reply With Quote
  #6  
Old January 16th, 2005, 07:43 PM
stensol stensol is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Netherlands
Posts: 28 stensol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 10 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > batch-file xcopy @pause (with 4 secs. delay)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT