How to Automatically Change NicePage HTML Titles

Do Find and Replace on All HTML Files in a Directory

Do you need to do mulitple find and replace pairs over many files in a directory? I have extended FNR.Exe with a simple batch file that loops through multiple find/replace pairs (bat10.bat) - as many as you need. FNR.Exe does one time find/replace for all files in a directory. No install of FNR.Exe is needed. Just put it in a folder and use it. bat10.bat extends it over many find/replace pairs.

Let's say you want to change all the HTML title tags in your NicePage directory. You enter each title tag in bat10.bat with its corresponding replacement. bat10.bat will take your first find/replace pair and loop through all the .html files in the specified directory. Then it will take the second find/replace pair and loop again. It will go through every find/replace pair.

Below is the input area of bat10.bat. You will need to edit it with a text editor.

rem START: Input area starts here

set loc_fnr="C:\Users\Matt\Downloads\fnr\fnr.exe"
set loc_data="C:\Users\Matt\Documents\Nicepage Templates\HomeFinancing4Me"

rem len is number of find/replaces you want to do. Or 1+max_index (here: max_index=2). 

set len=3

set obj[0].find="<title>Home</title>"
set obj[0].replace="<title>How to get a home mortgage when there are issues | HomeFinancing4Me</title>"

set obj[1].find="<title>Page 1</title>"
set obj[1].replace="<title>ITIN Lenders and Loans in 2021 | HomeFinancing4Me</title>"

set obj[2].find="find-stuff-3"
set obj[2].replace="replace-stuff-3"

rem Add as many as you want.

rem STOP: Input area stops here

loc_fnr = location of fnr.exe which you downloaded from
loc_data = location of NicePage directory with the HTML files you want changed.

set obj[3].find="<title>Page-10</title>"
set obj[3].replace="<title>My New Page Title | MyWebsite.Com</title>" 

max_index is now 3 because I added another find/replace pair. len = 3+1.
set len=4

To use it just open up the Command Prompt window - Windows Key + R, type CMD, enter. Navigate to folder with bat10.bat. For me, cd downloads, cd fnr because the path of the batch file is C:\Users\Matt\Downloads\fnr. Type bat10 on prompt line and hit enter. Done!

Note that you can use FNR.Exe directly if you wish to do one find/replace pair in one or more files. You can do find only searches too. Also, FNR.Exe can do normal or RegEx find or find/replace. So FNR.Exe is pretty handy. bat10.bat simply uses the command line feature of FNR.Exe to extend it capabilities.

Want to use RegEx in bat10.bat? Change this:

--includeSubDirectories => --includeSubDirectories --useRegEx

Don't touch "^". It is the line continuation marker.

Want more options? Go into FNR.Exe and see the button at the bottom: Gen Replace Command Line. Set up the options on the page and click the button. This will show you how to modify bat10.bat.

If you have problems then use FNR.Exe directly. Also, open up the html file with a text editor. Try copying the text directly from the html file into FNR.Exe. See if there is a match using the find button. I had to do this with some files.