Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.
Batch file to replace the string
Name: aswabh Date: July 23, 2009 at 23:57:05 Pacific OS: Windows server 2003 Subcategory: Batch
Comment:
i have a text file like this
## PROPERTY TO DECIDE IF THE DEFAULT IS SERVER ## PROVIDER_URL_REQUIRED = N TFA_EXTERNAL_LOCATION = D:\\auth.xml
i want to change the value of PROVIDER_URL_REQUIRED to Y. Remember there is spaces between PROVIDER_URL_REQUIRED and '=' sign. How to solve this using a batch file.
Name: Mechanix2Go Date: July 24, 2009 at 00:35:48 Pacific
Reply:
@echo off > newfile & setLocal enableDELAYedexpansion
for /f "tokens=* delims= " %%a in (myfile) do ( if "%%a"=="PROVIDER_URL_REQUIRED = N" ( >> newfile echo.PROVIDER_URL_REQUIRED = Y ) else ( >> newfile echo.%%a ) )
===================================== If at first you don't succeed, you're about average.
M2
0
Response Number 2
Name: ghostdog Date: July 24, 2009 at 03:13:59 Pacific
Reply:
you can try this vbscript
Set objFS = CreateObject("Scripting.FileSystemObject")
strFile = "c:\test\file.txt"
Set objFile = objFS.OpenTextFile(strFile)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
If InStr(strLine,"PROVIDER_URL_REQUIRED")>0 Then
strLine = Replace(strLine,"N","Y")
End If
WScript.Echo strLine
Loop
objFile.Close
Summary: Hi all, I have a HTML file, i want to find the string count "Failed" and "Success" and write the output in the csv file with the column1 as current day date, column3 as Success count and column3 as t...
Summary: Hi.. I am creating a batch file to replace a word in all the text files in a directory. File Example:- FILE 1:- "ISA*00* *00* *ZZ*ABCDEFGHI *ZZ*ABCDEFG " FILE 2:- "ISA*...
Summary: Hi chaps, I need to write a batch file to append the created date to the beginning of a bunch of files. There are hundreds of files, mostly office based so *.doc, *.xls, *.ppt etc. An example is a fi...