- @echo off
- set var=av sdkjf dfj sdjf df abc efg
- set var=%var: =.%
- for %%i in (%var%) do set "var=%%~ni"
- for %%i in (%var%) do set "var=%%~xi"
- echo %var:.=%
- pause
复制代码
或者
- @echo off
- set var=av sdkjf dfj sdjf df abc efg
- set var=%var: =.%
- call :get %var% 0
- call :get %var% 1
- echo %var:.=%
- pause
- exit
- :get
- if %2 == 0 (set var=%~n1) else set var=%~x1
复制代码
[ 本帖最后由 梦想种子 于 2008-3-29 23:27 编辑 ] |