你好,你上面说的那个批处理不是不能处理空格的文件,只是缺少了英文状态的双引号而已
前面2个:
@echo off&setlocal enabledelayedexpansion
set /p str=请输入你要删除的字符串的个数(如果是删除前面的,输入10;如果删除后面的,输入:-8 输入后请点击回车键):
for /d %%i in (*) do (
set "a=%%i"
set "b=!a:~0,%str%!"
ren "%%i" "!b!"
)
pause
后面2个:
@echo off
set /p str=请输入字符串(如-或[]):
for /d %%a in (*) do (
for /f "tokens=1 delims=%str%" %%b in ("%%a") do (
ren "%%a" "%%b"
)
)
pause
@ECHO OFF&Setlocal EnableDelayedExpansion
:1
set /p z=s输入去掉字符个数:
set /a y=1%z%1||goto 1
for /d %%i in (*) do (set a=%%i
set b=!a:~%z%!
echo %%i !b!
)
pause
_________________________________________________
@ECHO Off&Setlocal EnableDelayedExpansion
:1
set /p z=s输入去掉字符个数:
set /a y=1%z%1||goto 1
for /d %%i in (*) do (set a=%%i
set b=!a:~0,-%z%!
echo %%i !b!
)
pause
_________________________________________________
@ECHO On
for /f tokens^=1^,2^,*^ delims^=^- %%i in ('dir /ad /b *') do echo %%i-%%j %%i
pause
_________________________________________________
@ECHO On
for /f tokens^=1^,2^,*^ delims^=^[ %%i in ('dir /ad /b *') do echo %%i-%%j %%i
pause
_________________________________________________