The simple answer is to use the letters as described above, however the rest is elementary if you know how many characters you need to delete before your request. The following is an example with various ways to manipulate text using variables. The short answer is as follows
@echo off set phrase=Some other phrase echo %phrase:~11,6% pause
This script will set the variable "phrase" to "Some other phrase" You can access the rest of the text in the phrase using: ~ move to the eleventh character of the phrase and display the next 6 characters following it. Remember that spaces are characters, and the word phrase is 6 characters long.
The longer version used by my example to use the first letter of a word uses this to show how to manipulate words in text or variables.
goto :top :end echo. pause goto :EOF :top echo. SETLOCAL ENABLEDELAYEDEXPANSION ::Prompt for Name and set to variable "a" set /pa=Enter Name : echo. ::Set "aName" to the result of what was typed at the prompt. SET aName=%a% ::Set the First letter of "aName" to a new variable "firstletter" the 0,1 is the first character (0) 1 character long(1) set firstletter=%aName:~0,1% ::Set the variable "theRest" to the second character of "aName" to the 44th or whatever you choose ::pneumonoultramicroscopicsilicovolcanoconiosis is the longest word in the dictionary 45 characters long set theRest=%aName:~1,44% :: display the full name as 2 variables the first letter and the rest of the word/name echo %firstletter%%theRest% is what you typed the first letter is "%firstletter%" echo. CALL :UCase firstletter fl CALL :LCase therest tr echo %fl% being the uppercase first letter you typed echo. echo %fl%%aName:~1,44% is the uppercase first and the rest of the word as typed. echo. echo %fl%%tr% is the Uppercase first letter and all lowercase for the rest of the word. echo. echo %fl%%tr% >>%userprofile%\desktop\uppercaseresults.txt echo. echo A file named "uppercasereults.txt" was created on the desktop echo. echo with the name you typed above capitalized. CALL :UCase aName newName echo. ECHO.%newName% In all UPPERCASE echo. CALL :LCase aName newName ECHO.%newName% in all LOWERCASE ENDLOCAL goto end :LCase :UCase :: Converts to upper/lower case variable contents :: Syntax: CALL :UCase _VAR1 _VAR2 :: Syntax: CALL :LCase _VAR1 _VAR2 :: _VAR1 = Variable NAME whose VALUE is to be converted to upper/lower case :: _VAR2 = NAME of variable to hold the converted value :: Note: Use variable NAMES in the CALL, not values (pass "by reference") SET _UCase=ABCDEFGHIJKLMNOPQRSTU VWXYZ SET _LCase=abcdefghijklmnopqrstu vwxyz SET _Lib_UCase_Tmp=!%1! IF /I "%0"==":UCase" SET _Abet=%_UCase% IF /I "%0"==":LCase" SET _Abet=%_LCase% FOR %%Z IN (%_Abet%) DO SET _Lib_UCase_Tmp=!_Lib_UCase_Tmp:%%Z=%%Z! SET %2=%_Lib_UCase_Tmp% goto :EOF :EOF goto :end
source share