Re: How to UPCASE string in bat files?
- From: "VanguardLH" <V@xxxxxxxxx>
- Date: Fri, 29 Feb 2008 09:45:26 -0600
"ILiya" <iliya00@xxxxxxxxx> wrote in message news:eab%23cpqeIHA.4260@xxxxxxxxxxxxxxxxxxxxxxx
For example %cd% returns the current path. How to make what %cd% returns be all in the upper or in lower case?
Thanks
Use character substitution with the 'set' command. Run 'set /?' to see the comments on how to do substitution. Write a subroutine (i.e., a section outside the flow of control using a :label) that you call to do the translation.
@echo off
setlocal
....
echo Original value = %CD%
call UPPER "%CD%"
echo Uppercased value = %var%
....
goto EndBatch <-- (see NOTE)
....
:UPPER
set var=%~1
set %var:a=A%
set %var:b=B%
set %var:c=C%
(repeat for each character)
exit
....
:EndBatch
....
NOTE: Use 'goto :EOF' if you don't have any cleanup at the end of the batch script (might not be needed if you use 'setlocal').
This is just off the top of my head. I haven't tested for correctness. Just providing some hints.
.
- Follow-Ups:
- Re: How to UPCASE string in bat files?
- From: Pegasus \(MVP\)
- Re: How to UPCASE string in bat files?
- References:
- How to UPCASE string in bat files?
- From: ILiya
- How to UPCASE string in bat files?
- Prev by Date: Re: Grouping Menu Items on the Star Menu All Programs`
- Next by Date: Re: Windows Administrator Paswword
- Previous by thread: Re: How to UPCASE string in bat files?
- Next by thread: Re: How to UPCASE string in bat files?
- Index(es):
Relevant Pages
|
|