
January 7th, 2008, 11:23 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] Presenting a Menu (as with 'Choice')
Objective:
I have a PortableApps-enabled USB drive, and I'm using the Portable Sunbird that's on it to keep track of my time at any available computer. I also use a stationary installation of Sunbird on my desktop and (soon) another on my laptop. (Portable Sunbird is still in version 0.3, while the standard one from Mozilla is at 0.7. Also, I might not always have my USB stick available, so this is safer than only using Portable Sunbird.) I want to write a macro that will ask me, when I plug my USB drive into a computer, which calendar should be migrated to the other Sunbird: the portable one, the stationary one, or neither.
Problem:
Each download of PortableApps is packaged with an "Autorun.inf" file to allow the user to quickly start the menu each time the subject drive is plugged in, and I have modified that file so it starts my "disbatch.bat," which in turn starts the PortableApps menu and should ask me which action to take. But because I'm using Windows XP and the only multiple-choice command I know of is choice, I get this: Quote: | 'choice' is not recognized as an internal or external command, operable program or batch file. | What can I use instead?
BTW, I know I'll probably find more problems when I try to do more than just start Sunbird (export, import, and close) from a batch, but for now I need my menu to work.
Here's "disbatch.bat":
Code:
@ECHO OFF
:: disbatch.bat
:: Start PortableApps.
START PortableApps\PortableAppsMenu\PortableAppsMenu.exe
:: 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. Migrate data from portable calendar to stationary installation.
ECHO b. Migrate data from stationary calendar to portable installation.
ECHO c. Migrate no data.
choice /c:cba /tc,10 Which option do you choose [a,b,c]?
:: Delete this line when the menu is fixed:
PAUSE>NUL
:: Do as directed.
IF ERRORLEVEL 3 GOTO a
IF ERRORLEVEL 2 GOTO b
IF ERRORLEVEL 1 GOTO c
:a
::
GOTO done
:b
::
GOTO done
:c
ECHO Very well. Handle it yourself, then.
:done
Thanks!
Last edited by Jesdisciple : January 7th, 2008 at 02:23 PM.
Reason: to include category in title
|