Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi-
I have two files, called page1.txt and page2.txt, and I need to create a bat file which will replace the text "Heading", "Heading2" , "Heading3" , and "Heading4" with whatever the user inputs. Please help. Thanks in advance!
Jaylo

You might be able to do that with variables and %variablename%.xxx type of "coding". Can you describe the problem with a bit more detail?

Hi,
Below is a file for adding to the beginning of a file or adding to the end of a file.
In dos it will allow you to start (it then exits) but alows you to type in the command with the help file visable.If you want to run from windows then you need to call it....well you will see.
ad thefile.name b enter or ad thefile.name e
cls
@echo off
if not "%1"=="" goto 1stpr
:start
echo.
echo EXAMPLE:Type... AD MY.doc b
echo Type... AD My.doc e
echo Command Results
echo.
echo AD (file name) b Adds to the beginning of a (file).
echo AD (file name) e Adds to the end of a (file).
goto end
:1stpr
if "%2"=="" goto start
if %2==b goto 2cdpr
if %2==e goto 2cdpr
goto start
:2cdpr
if exist %1 goto ok
echo.echo I can't seem to find a file named... %1.
echo.
echo Lets try it again, with a different spelling.
echo.
goto start
:ok
echo.
echo Type the line or lines to be added.
echo After the last line, press (F6) and (enter).
echo.
if %2==b copy con+%1 ad.$$$ > nul
if %2==e copy %1+con ad.$$$ > nul
erase %1
rename ad.$$$ %1
echo.
echo These are the new contents of $1:
echo.
more < %1
:end
The above should work so just do a copy and paste....save as ad.bat. Adjustments...knocking on wood should be easy.Hope this is of some help.
World Library

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |