Batch - Converting variable to uppercase

前端 未结 8 1710
一向
一向 2020-12-02 01:39

How would I go about changing the destl variable to uppercase before it is used. I assume some sort of character swap, however I couldn\'t get it working. C

8条回答
  •  自闭症患者
    2020-12-02 02:22

    Thanks for the responses guys, I solved it using this -

    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
    

    I'm sure your responses are far neater and more efficient, but as mine is doing the trick and I don't want to break anything I will leave it as is!

    Thank you for your input!

提交回复
热议问题