我的目的是便利文件,把文件名小写字母改成大写字母,代码如下:- @echo off
- setlocal enabledelayedexpansion
- for %%i in (*.*) do (
- set a=%%i
- set c=%%~xi
- set b=%%~ni
- if !c! neq ^.bat (
- call :aa !b!
-
- )
- )
- pause
- :aa
- setlocal enabledelayedexpansion
- for %%l in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
-
- set d=!!b:%%l=%%l!!
-
- )
- echo !!d!!
复制代码 我的代码查看变量!!d!!没有变成大写字母,请问问题在哪里,求教??
========================================================================
感谢二楼,经过修改成功解决了问题: 代码如下:- @echo off
- set "up=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
- setlocal enabledelayedexpansion
- for %%i in (*.*) do (
- set "b=%%~ni"
- set "a=%%~xi"
- for %%a in (!up!) do (
- set "b=!b:%%a=%%a!"
- )
- if !a! neq ^.bat (
- ren %%i !b!!a!
- )
- )
- pause
复制代码
|