我的需求是在编写脚本实现提取项目程序中的版本号(使用tokens语句提取指定内容也就是版本号赋值到变量str1),然后再自动编译重命名文件生成带版本号的烧录文件(这里令文件名为new),通过ccs调用后(如上图将脚本写进该框内),生成的文件直接显示为new,而不是我想要的带版本号的文件名,想问如何让这个变量成功赋值显示?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我的需求是在编写脚本实现提取项目程序中的版本号(使用tokens语句提取指定内容也就是版本号赋值到变量str1),然后再自动编译重命名文件生成带版本号的烧录文件(这里令文件名为new),通过ccs调用后(如上图将脚本写进该框内),生成的文件直接显示为new,而不是我想要的带版本号的文件名,想问如何让这个变量成功赋值显示?
@echo off
setlocal enabledelayedexpansion
for /f "tokens=2,3" %%i in (CFG_SysParaInit.h) do (
if %%i==DSP_VERSION (
set str1=%%j
set str2=TPaa!str1!
echo !str2!
)
)
for /f "tokens=2,3" %%i in (CFG_SysParaInit.h) do (
if %%i==DSP_DEBUG_VERSION (
set str3=%%j
set str4=_D!str3!
set new1=!str2!!str4!_075
echo !new1!
)
)
for /f "tokens=2,3" %%i in (CFG_SysParaInit.h) do (
if %%i==DSP_VERSION2 (
set str5=%%j
set str6=TPaa!str5!
echo !str6!
set new2=!str6!!str4!_075
echo !new2!
)
)
for /f "tokens=2,3" %%i in (CFG_SysParaInit.h) do (
if %%i==HIL_TEST (
set str=%%j
if "!str!"=="0" (
cd "../../.././CPU1_FLASH"
copy WIS215KW_TL3_inv_f28075.hex WIS215KW_TL3_inv_f28075bak.hex
ren WIS215KW_TL3_inv_f28075bak.hex !new2!.hex
)
if "!str!"=="1" (
cd "../../.././CPU1_FLASH"
copy WIS215KW_TL3_inv_f28075.hex WIS215KW_TL3_inv_f28075bak.hex
ren WIS215KW_TL3_inv_f28075bak.hex !new1!.hex
)
)
)
pause