下面的一段bat脚本作用是,根据提示给出一个变量,来修改我现有的一个sql脚本
公可以实现,但是在echo输出的时候会有一个“echo is off”在后面附加着,这样我的sql脚本就会出错了
如何把“echo is off”这句话,不要附加在我的sql脚本后面,谢谢,高手~!setlocal enabledelayedexpansion
set file=1INS_GamePatch.sql
REM set /p file=  请输入INS_GamePatch.sql(包括扩展名):
set "file=%file:"=%"
for %%i in ("%file%") do set file=%%~fi
echo.
set replaced=%%LauncherServerIP%%
REM set /p replaced= 请输入要替换的LauncherServerIP:
echo.
set all=
set /p all=  请输入LauncherServerIP:
for /f "delims=" %%i in ('type "%file%"') do (
    set str=%%i
    set "str=!str:%replaced%=%all%!"
    echo !str!>>"%file%"_tmp.txt
)
copy "%file%" "%file%"_bak.txt >nul 2>nul
move "%file%"_tmp.txt "%file%"
REM start "" "%file%"