- @echo off
- set /p Input=输入:
- for /f "delims=" %%i in ('findstr /n .* 1.ini') do (
- set "s=%%i"
- setlocal enabledelayedexpansion
- set "s=!s:*:=!"
- if /i "!s:~0,10!" == "AppServer=" (
- echo;AppServer=%Input%
- ) else (
- echo;!s!
- )
- endlocal
- )
- pause
复制代码
- @if (0)==(0) echo off
- set /p Input=输入:
- cscript //nologo //e:jscript "%~f0" < 1.ini "%Input%"
- pause & goto :EOF
- @end
-
- var s = WSH.StdIn.ReadAll().replace(/^(AppServer=)[^\r\n]*/gmi,'$1' + WSH.Arguments(0));
- WSH.Echo(s)
复制代码
- set "Input=1.1.1.1"
- gawk "BEGIN{IGNORECASE=1};{sub(/^AppServer=.*/,\"AppServer=%Input%\",$0);print}" 1.ini
复制代码
- set "Input=1.1.1.1"
- sed -r "s/^(AppServer=).*/\1%Input%/" 1.ini
复制代码
- set "Input=1.1.1.1"
- PowerShell -c "(type 1.ini) -replace '(?<=^AppServer=).*', '%Input%'"
复制代码
|