I tried this code in the batch file but it could not work.
I wanted to take the first line from the DefaultGateway.txt and replace the 5th line ip address in NewFile.txt.
Batch File Codes :
ipconfig /all | findstr Gateway > "C:\Program Files (x86)\""Wireless Guard\""DefaultGateway.txt"
SetLocal EnableDelayedExpansion
type nul > NewFile.txt
set "Default" =Start Line of Paragraph
set "254"=End Line which is not Included
set Flag=0
for /f "tokens=* delims=" %%a in ('type DefaultGateway.txt') do (
if /i "%StartText%" EQU "%%a" (set Flag=1)
if /i "%EndText%" EQU "%%a" (set Flag=0)
if !Flag! EQU 1 echo %%a >> NewFile.txt
)
DefaultGateway.txt :
Default Gateway . . . . . . . . . : 172.20.128.254 Default Gateway . . . . . . . . . : Default Gateway . . . . . . . . . :
NewFile.txt :
remarks:This document is for Linksys for version v4.30.5, the auto sensing part. "C:\Program Files (x86)\Wireless Guard\wget" --http-user= --http-password=admin http://192.168.1.1/WClientMACList.htm REM del WClientMACList.txt REM del arp.txt REM del Intruder1.txt copy WClientMACList.htm WClientMACList.txt del WClientMACList.htm REM del WL_ActiveTable.asp REM do ping for 20 seconds REM ping -n localhos

New Topic/Question
Reply



MultiQuote


|