我正在尝试在目录路径 (C:\ExecutionSDKTest_10.2.2\Logs) 后面和文件扩展名 (.log) 之前批量连接文件名 (fileName),但我认为因为我的文件名包含前导和尾随空格,所以cmd.exe 无法识别串联路径 (logPath)。有任何想法吗?
FOR %%G IN (C:\ExecutionSDKTest_10.2.2\*.properties) DO (
Set fileName= %%~nxG
REM echo !fileName!
REM java -jar Test.jar %%~nxG > Logs\%%~nxG.log
set logPath=%C:\ExecutionSDKTest_10.2.2\Logs\%%!fileName!%%.log%
Echo !logPath!
REM print each line in each of the log files
REM FOR /F "tokens=*" %%g in (!logPath!) DO (
REM echo %%g
REM )
pause
)