我有一个包含以下信息的文本文件:
X:\Mr.Wizard\Desktop\校准说明\CUP CALIBRATION.doc
X:\Mr.Wizard\桌面\文档\说明\Variance.doc
就我而言,我无法确定如何打开资源管理器到该路径。我一直尝试将变量 filedrive 和 filepath 连接到一个名为 Exp_Path 的变量中,但是我得到了一个空变量,所以我只是继续删除该部分代码。请帮忙……
@echo OFF
SETLOCAL EnableExtensions DisableDelayedExpansion
chcp 65001
@echo on
for /f "tokens=*" %%i in (C:\TestFileListing.txt) do (
ECHO filedrive=%%~di
ECHO filepath=%%~pi
ECHO filename=%%~ni
ECHO fileextension=%%~xi
pause
explorer.exe "%%~pi"
del /P /F "%%i"
echo "%%i" >> "Processedfiles.txt"
)
endlocal
Echo Process Completed
set /p="Press Any Key to Continue"
答案1
@echo off
chcp 65001 | cls
for /f delims^= %%i in ('type C:\TestFileListing.txt'
)do (
echo; Drive=%%~di
echo; Path=%%~pi
echo; Name=%%~ni
echo; Extension=%%~xi
pause
start "" /b explorer.exe "%%~fi"
echo;del /p /f /a: "%%~fi"
echo; "%%i" >>"Processedfiles.txt"
)
echo;Process Completed
timeou -1 | echo\Press Any Key to Continue...
或者...
@echo off
for /f delims^= %%i in ('type "C:\TestFileListing.txt"'
)do >>"C:\The\Full\Path\To\File\Processedfiles.txt" (
start "" /b /min explorer.exe "%%~fi"
echo;del /p /f /a: "%%~fi"
echo;"%%i"
)
echo;Process Completed
timeou -1 | echo\Press Any Key to Continue...