cmd batch script function with return values
>> YOUR LINK HERE: ___ http://youtube.com/watch?v=moYlQsyDm6E
Hello everyone! I hope this video has helped solve your questions and issues. This video is shared because a solution has been found for the question/problem. I create videos for questions that have solutions. If you have any other issues, feel free to reach out to me on Instagram: / ky.emrah • Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!cmd batch script function with return values • I found string functions like toUpper for batch files here, and also on stackoverflow, but I am unable to figure out how to use them. I found several examples and instructions, some of which are contradictory, but none of them worked for me, for some reason. How would I use a function like this in a .bat file? Here is a sample code for toUpper: • toUpper • here • toUpper • @echo off • setlocal enabledelayedexpansion • :: Main script starts here • set arg=exampleString • :: Output the original • echo Original: %arg% • :: Call the toUpper function to convert %arg% to uppercase • call :toUpper arg • :: Output the result • echo Uppercase: %arg% • EXIT /b 1 • • :toUpper str -- converts lowercase character to uppercase • if not defined %~1 EXIT /b • for %%a in ( a=A b=B c=C d=D e=E f=F g=G h=H i=I • j=J k=K l=L m=M n=N o=O p=P q=Q r=R • s=S t=T u=U v=V w=W x=X y=Y z=Z ä=Ä • ö=Ö ü=Ü ) do ( • call set %~1=%%%~1:%%~a%% • ) • EXIT /b • @echo off • setlocal enabledelayedexpansion • :: Main script starts here • set arg=exampleString • :: Output the original • echo Original: %arg% • :: Call the toUpper function to convert %arg% to uppercase • call :toUpper arg • :: Output the result • echo Uppercase: %arg% • EXIT /b 1 • • :toUpper str -- converts lowercase character to uppercase • if not defined %~1 EXIT /b • for %%a in ( a=A b=B c=C d=D e=E f=F g=G h=H i=I • j=J k=K l=L m=M n=N o=O p=P q=Q r=R • s=S t=T u=U v=V w=W x=X y=Y z=Z ä=Ä • ö=Ö ü=Ü ) do ( • call set %~1=%%%~1:%%~a%% • ) • EXIT /b • What I get is this: • Original: exampleString • Uppercase: ββ=β£ rg:ββ=β£ • Original: exampleString • Uppercase: ββ=β£ rg:ββ=β£ • What's going on here? • EDIT: added missing return statement (see comments to answer) • • Tags: batch-file,cmdSource of the question: • https://stackoverflow.com/questions/7... • Question and source license information: • https://meta.stackexchange.com/help/l... • https://stackoverflow.com/
#############################