|
-
Jun 22nd, 2005, 04:56 AM
#1
Thread Starter
Frenzied Member
Batch file variable case conversion
Hi,
I have this batch file which I am running in XP. What I want to be able to do is get the batch to convert the user's input to uppercase (the Project1.exe that I am launching only recognises uppercase).
Can anyone help?
Code:
@ECHO OFF
:start
CLS
ECHO GenMail Launcher (Tristan Uglow June 2005)
ECHO.
ECHO CA Campaigns
ECHO DD DirectDebits
ECHO GM GeneralMailingecho.
SET choice=
SET /p choice=Choose Mode (or X for exit):
if '%choice%'=='' goto end
if '%choice%'=='X' goto end
"C:\Program Files\MyProg\Project1.EXE" '%choice%'
goto start
:end
This world is not my home. I'm just passing through.
-
Jun 22nd, 2005, 05:01 AM
#2
-
Jun 22nd, 2005, 05:08 AM
#3
Thread Starter
Frenzied Member
Re: Batch file variable case conversion
Instead of converting the data you pass as %choice% you can make %choice% uppercase in your application and then compare it with whatever you want
I can't make any changes to Project1.exe. I can only make changes to the batch file. The example I've given is a simplification of what I'm really working with. I still want to know how to convert the case of what the user types in in the batch file.
Thanks for your suggestion anyway, this would have been the best solution if it was possible...
This world is not my home. I'm just passing through.
-
Jun 22nd, 2005, 06:49 AM
#4
Re: Batch file variable case conversion
i don't know how to do what you ask, but one option is to use choice as a numbered menu, or else scrap teh batch file and use a vb script (which i have just found out how to do)
menu example
ECHO 1. MS-DOS Editor.
ECHO 2. MS-Windows. (default)
ECHO 3. Defrag the hard-drive.
ECHO 4. Quit.
CHOICE /C:1234 /N /T:2,5 Please choose a menu option.
IF ERRORLEVEL == 4 GOTO QUIT_MENU
IF ERRORLEVEL == 3 GOTO DEFRAG_HD
IF ERRORLEVEL == 2 GOTO RUN_WIN
IF ERRORLEVEL == 1 GOTO RUN_EDIT
:RUN_EDIT
CALL EDIT
:RUN_WIN
CALL WIN
 EFRAG_HD
DEFRAG c:
:QUIT_MENU
ECHO Safe to switch off machine now...
pete
-
Jun 22nd, 2005, 06:54 AM
#5
Thread Starter
Frenzied Member
Re: Batch file variable case conversion
Thanks for the suggestion Pete.
CHOICE isn't available in WinXP which is why I've used the alternative method. I could have gone for the numbered approach (although I've got more than 10 options in my real-world case so I'd have to use alpha characters instead).
I've just got fixated on finding out how to do the case conversion - it must be possible musn't it?
I may well end up doing a VB solution after all. How do you go about doing that? Presumably it's different from just writing an exe?
This world is not my home. I'm just passing through.
-
Jun 22nd, 2005, 08:24 AM
#6
Re: Batch file variable case conversion
no just write an exe with an input box then shell to your program and unload
also i believe it would be possible to do what you want in your batch file
this works, i tested, but it would have to be for each valid input
if '%choice%'=='dd' SET choice=DD
there is probably other solutions, i've forgotten a lot of the batch file stuff now
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|