Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Does anyone have a DOS change script?  (Read 2089 times)

0 Members and 1 Guest are viewing this topic.

KenL

    Topic Starter


    Beginner
    Does anyone have a DOS change script?
    « on: March 26, 2008, 12:19:12 PM »
    Hello all, well I went and did it...I "upgraded" to Windows XP x64...and my trusty CHANGE.EXE program from Bill Guthrie (http://users.erols.com/waynesof/bruce.htm) no longer works. Says it is from a different operating system. I have sent Bruce an email, but in the mean time;

    Has anyone created a similar program in a BAT file? or does anyone have anyting that I can use to create one?
    I would prefer to do it in a straight BAT format for easier maintenance.

    Ken
    Windows XP PRO/Server 2003. Date Format DD/MM/YYYY

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: Does anyone have a DOS change script?
    « Reply #1 on: March 26, 2008, 01:16:07 PM »
    This is probably more down and dirty than your utility, but it works ok as a generic search and replace:

    Code: [Select]
    @echo off
    setlocal enabledelayedexpansion
    set txtfile=c:\scripts\text.txt
    set newfile=c:\scripts\text.chg

    if exist "%newfile%" del /f /q "%newfile%"

    set /p search=Search String=
    set /p replace=Replace With=

    for /f "tokens=*" %%a in (%txtfile%) do (
       set newline=%%a
       set newline=!newline:%search%=%replace%!
       echo !newline! >> %newfile%
    )

    You should have no trouble making modifications.  8)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein