- 帖子
- 22
- 积分
- 284
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2008-8-18
|
受教了!
学习之后修改如下,目前测试没有发现问题.
@echo off&setlocal enabledelayedexpansion
cls
if "%1"=="" goto callmyself
call :getfullname %1
echo "%filepath%"
echo "%filename%"
echo "%fileext%"
pause
:getfullname
::需要 setlocal enabledelayedexpansion
::使用 %filepath%\%filename%.%fileext%
set "p=%~s1"
set "filepath=%~d1"
set "filename=%~nxs1"
set "fileext=%~x1"
for %%i in (%filepath% %filename%) do set "p=!p:%%i=!"
set "p=%p:\= %"
for %%i in (%p%) do for /f "tokens=*" %%j in ('dir /ad /b "!filepath!\%%i*"') do set "filepath=!filepath!\%%j"
for /f "tokens=*" %%i in ('dir /b "%filepath%\%filename%*"') do set "filename=%%i"
set "filename=!filename:%~x1=!
set "fileext=%fileext:.=%"
exit /b
:callmyself
call %0 C:\PROGRA~1\COMMON~1\MICROS~1\DAO\dao360.dll
[ 本帖最后由 dishuo 于 2008-8-18 22:24 编辑 ] |
|