Windows命令行获取文件名首字母及移除首下划线失败的问题求助
Windows命令行获取文件名首字母及移除首下划线失败的问题求助
我最近碰到个棘手的小问题,想批量去掉一批DLL文件名开头的下划线,比如把_Telerik.Windows.*.dll这类文件名改成不带首下划线的版本,试了命令但一直报错,实在没辙了来求大家帮忙!
我用的命令是这样的:
for %f in (_Telerik.Windows.*.dll) do set "filename=%f" && ren "%f" "%filename:~1%"
结果每次执行都会弹出类似下面的错误提示:
C:\Directory\set "filename=_Telerik.Windows.Themes.Windows8Touch.dll" && ren "_Telerik.Windows.Themes.Windows8Touch.dll" "Telerik.Windows.Zip.dll"
A duplicate file name exists, or the file cannot be found.C:\Directory\set "filename=_Telerik.Windows.Zip.dll" && ren "_Telerik.Windows.Zip.dll" "Telerik.Windows.Zip.dll"
A duplicate file name exists, or the file cannot be found.
对了,我已经提前开启了setlocal enabledelayedexpansion,但还是解决不了这个问题。有没有大佬能教教我怎么正确移除这些文件名开头的下划线呀?
备注:内容来源于stack exchange,提问作者Dominique
相关产品推荐
相关产品推荐

