
January 12th, 2008, 11:14 AM
|
|
n00b DevH'er
|
|
Join Date: Jan 2008
Location: Tejas
Posts: 9
Time spent in forums: 3 h 3 m 29 sec
Reputation Power: 0
|
|
|
NT Batch - [NT Batch] Copying
I almost have the file from my previous post finished. I found out from the Mozillazine community that Sunbird stores calendar data in an SDB database file. My batch now attempts to copy one database file to the location of the other, but the copied file appears in my USB root directory, where it can't do any good. Why? Thanks!
Code:
@ECHO OFF
:: disbatch.bat
:: Start PortableApps.
START PortableApps\PortableAppsMenu\PortableAppsMenu.exe
:: NOTE: There isn't really a space character between "\DefaultData" and "\profile":
SET cargo=PortableApps\SunbirdPortable\App\DefaultData \profile\storage.sdb
SET station=
SET laptop=C:\Documents and Settings\_Somebody_\Application Data\Mozilla\Sunbird\Profiles\x86bg1hg.default\sto rage.sdb
SET home=C:\Documents and Settings\_SomebodyElse_\Application Data\Mozilla\Sunbird\Profiles\itlexnrd.default\sto rage.sdb
:: Prompt the user (me) for whether to migrate my calendar (for Sunbird)
:: from my USB stick to my PC (laptop or desktop), vice versa, or not at all.
ECHO What do you want to do? Your options follow.
ECHO a. Copy data from portable calendar to stationary installation.
ECHO b. Copy data from stationary calendar to portable installation.
ECHO c. Copy no data.
:question
ECHO Which opton do you choose [a,b,c]?
:: Wait for user input.
SET /P answer=
:: Do as directed.
IF %answer%==a GOTO a
IF %answer%==b GOTO b
IF %answer%==c GOTO c
:: The program will only run the following statement if the user made
:: a choice that was not available.
GOTO question
:a
IF EXIST laptop SET station=%laptop%
IF EXIST home SET station=%home%
IF station== ECHO Error: Neither stationary file was found.
COPY %cargo% "%station%"
ECHO Mission accomplished: This stationary calendar now reflects your portable one.
GOTO done
:b
IF EXIST laptop SET station=%laptop%
IF EXIST home SET station=%home%
IF station== ECHO Error: Neither stationary file was found.
COPY %station% "%cargo%"
ECHO Mission accomplished: Your portable calendar now reflects this stationary one.
GOTO done
:c
ECHO Very well. Handle it yourself, then.
:done
PAUSE
|