How to convert the value of %USERNAME% to lowercase within a Windows batch script?

后端 未结 9 611
暗喜
暗喜 2020-12-09 17:10

I\'m automating some source control software functionality using a dot bat script but given that our svn repos are hosted in a *NIX box, I\'m facing the eternal case problem

9条回答
  •  醉话见心
    2020-12-09 17:26

    download some unix utilities for DOS from http://short.stop.home.att.net/freesoft/unix.htm and use tr.exe (translate characters)

    echo %USERNAME% | tr "[A-Z]" "[a-z]" 
    

    I also use a DOS extended cmd replacement named 4NT which has a built in command @lower

    echo %@lower[%USERNAME%]
    

提交回复
热议问题