Use command-line reference in a script to convert an uppercase str
1 réponse
Bruno
In a generic command script we want to use the %computername% environment
variable.
But the result is in upper case e.g. "HAW11" (even if the computer name is
"haw11").
The thrid part tool requires the name to be in lower case : haw11.
Is there anyway to convert the uppercase string to a lowercase string in a
command script.
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Gilles LAURENT
"Bruno" a écrit dans le message de news:
[...]
| Is there anyway to convert the uppercase string to a lowercase string | in a command script.
Below an example of script which include the conversion subroutine :
-- cut here : _toLower.cmd --
@echo off
call :_tolower %computername% echo [%_toLower%]
call :_tolower CONVERT ME TO LOWERCASE echo [%_toLower%]
goto :eof
rem converts a string to all lower case letters rem on input the string to convert to lowercase rem on output the environment variable %_toLower% contains rem the converted string :_toLower echo>"%temp%%*" for /f "tokens=*" %%i in ('dir/b/l "%temp%%*"') do set _toLower=%%i del "%temp%%*"
-- cut here : toLower.cmd --
Hope this helps. Let us know.
-- Gilles LAURENT Me contacter : http://cerbermail.com/?zoTY7ZkLcD
"Bruno" <Bruno@discussions.microsoft.com> a écrit dans le message de
news:53EE15FC-5A12-4E51-A40B-9E24AC10D814@microsoft.com
[...]
| Is there anyway to convert the uppercase string to a lowercase string
| in a command script.
Below an example of script which include the conversion subroutine :
-- cut here : _toLower.cmd --
@echo off
call :_tolower %computername%
echo [%_toLower%]
call :_tolower CONVERT ME TO LOWERCASE
echo [%_toLower%]
goto :eof
rem converts a string to all lower case letters
rem on input the string to convert to lowercase
rem on output the environment variable %_toLower% contains
rem the converted string
:_toLower
echo>"%temp%%*"
for /f "tokens=*" %%i in ('dir/b/l "%temp%%*"') do set _toLower=%%i
del "%temp%%*"
-- cut here : toLower.cmd --
Hope this helps. Let us know.
--
Gilles LAURENT
Me contacter : http://cerbermail.com/?zoTY7ZkLcD
| Is there anyway to convert the uppercase string to a lowercase string | in a command script.
Below an example of script which include the conversion subroutine :
-- cut here : _toLower.cmd --
@echo off
call :_tolower %computername% echo [%_toLower%]
call :_tolower CONVERT ME TO LOWERCASE echo [%_toLower%]
goto :eof
rem converts a string to all lower case letters rem on input the string to convert to lowercase rem on output the environment variable %_toLower% contains rem the converted string :_toLower echo>"%temp%%*" for /f "tokens=*" %%i in ('dir/b/l "%temp%%*"') do set _toLower=%%i del "%temp%%*"
-- cut here : toLower.cmd --
Hope this helps. Let us know.
-- Gilles LAURENT Me contacter : http://cerbermail.com/?zoTY7ZkLcD