【发布时间】:2012-06-17 09:34:09
【问题描述】:
好的,所以我正在使用内置更新程序创建一个脚本,它使用以下代码创建一个新文件并更新几个变量,但由于某种原因这不起作用,任何人都知道如何修复它或类似的将做大致相同的事情的脚本。
@echo off
setlocal enabledelayedexpansion
set /p "findthis"="1"
set /p "replacewith"="1.2.3"
call:updater
set /p "findthis"="2"
set /p "replacewith"="2.3.4"
call:updater
set /p "findthis"="3"
set /p "replacewith"="3.4.5"
call:updater
goto:eof
:updater
for /f "tokens=*" %%a in (updateme.bat) do (
set write=%%a
if %%a==%findthis% set write=%replacewith%
echo !write!
echo !write! >>%~n1.replaced%~x1
)
goto:eof
【问题讨论】:
标签: file batch-file replace find