Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Time out  (Read 2065 times)

0 Members and 1 Guest are viewing this topic.

KaMaKaZi_KiNg

  • Guest
Time out
« on: September 21, 2006, 09:39:40 PM »
I am writing a batch scrip that will give the user the option of backing up files and syncing files or both, and i am wanting to set it that it the user hasn't inputted a selection in a determained set of time (30 seconds) it will automatically backup the data.

That is the top part of the batch script. the rest of it is just defining where to copy to and sync from. also i am wanting a way that i can get the batch to zip the backup either before it is copied or after then deleting the uncompressed files.

The batch will be run on windows xp

thank you for your help. I greatly appreciate it

@ECHO off
:start
cls
ECHO.
ECHO 1. Backup Data
ECHO 2. Sync All About Users Data
ECHO 3. Back up and sync
ECHO 4. Exit
ECHO.
set choice=
set /p choice=Choose and option:
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto backup
if '%choice%'=='2' goto sync
if '%choice%'=='3' goto both
if '%choice%'=='4' goto exit
ECHO "%choice%" is not valid please try again
ECHO.
« Last Edit: September 21, 2006, 09:46:32 PM by KaMaKaZi_KiNg »

Dilbert

  • Moderator


  • Egghead

  • Welcome to ComputerHope!
  • Thanked: 44
    Re: Time out
    « Reply #1 on: September 21, 2006, 09:50:56 PM »
    Hi, KaMaKaZi_KiNg,

    Unfortunately, the set /p will wait indefinitely from the user. The only batch function that will wait a while would be a hidden PING command. Unfortunately, that will not have a prompt.

    DOS batch files will not, I'm afraid, do this. Now, if you were talking about C++, Visual Basic or some other programming language you'd have a solution, because you can run a timer in a seperate thread from the prompt. But this is impossible in the batch pseudo-language.
    "The geek shall inherit the Earth."

    KaMaKaZi_KiNg

    • Guest
    Re: Time out
    « Reply #2 on: September 21, 2006, 10:02:44 PM »
    *censored*.. i dont know any programming language so i guess i'll just have to leave it how it is.

    can the zip bit be done or is that a c++ or VB job aswell?

    also i am wanting to rename the backup folder to have the date and time on the end of the name. (eg. backup_1428_220906)
    « Last Edit: September 21, 2006, 10:26:09 PM by KaMaKaZi_KiNg »