Jump to content

stevielamb

Member
  • Posts

    2
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United Kingdom

About stevielamb

Profile Information

  • OS
    Windows 7 x86

stevielamb's Achievements

0

Reputation

  1. I had actually forgotten that the "for loop" existed in windows batch scripts! Anyway, here's a revised version of the script:- @echo offsetlocal enableDelayedExpansionFOR /l %%s in (10, -1, 0) DO ( cls choice /C YNX /n /t 1 /d X /M "Invoking SyncToy in %%s seconds, press Y to cancel or N to proceed anyway." if !errorlevel!==1 ( echo Sync cancelled. Logging off... exit /B ) if !errorlevel!==2 goto backup):backupecho Invoking SyncToy...CALL "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -Rexit /B 0In reply to your other question, the "Sync cancelled. Logging off..." message remains on the screen just long enough to read it before the dos window shuts. Thanks for your response. Steve.
  2. Hi all, I've just started using SyncToy to backup my data and I wanted it to be executed during the computer's log-out process. However, I also needed the option to cancel the sync process from running if, for example, it had already run earlier so I put together this little countdown batch script which seems to do the job nicely. Essentially, when the script is invoked it gives you 10 seconds to press the "Y" button to cancel (during which time a running countdown is displayed) and after the 10 seconds have elapsed if you haven't pressed the "Y" button it will proceed to run the SyncToy process:- @echo offset countdown=10:loopclschoice /C YN /n /t 1 /d N /M "Press Y to cancel sync. [%countdown%]"if %errorlevel%==1 ( echo Sync cancelled. Logging off... exit /B >nul)if %countdown% gtr 0 ( set /A countdown-=1 goto loop)echo Invoking SyncToy...CALL "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe" -Rexit /B 0Hopefully, this may prove useful to someone. All the best, Steve.
×
×
  • Create New...