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

Author Topic: Find a string in a running batch file and replace it.  (Read 3671 times)

0 Members and 1 Guest are viewing this topic.

BatchFileCommand

    Topic Starter


    Hopeful
  • Thanked: 1
    Find a string in a running batch file and replace it.
    « on: January 11, 2009, 01:37:06 PM »
    I used the search, and everything I found didn't help much. So, how would you find a string in a batch file, and using the same batch file replace that string.
    οτη άβγαλτος μεταφ βαθμολογία

    Dias de verano

    • Guest
    Re: Find a string in a running batch file and replace it.
    « Reply #1 on: January 11, 2009, 03:27:44 PM »
    You want a batch file to alter itself?

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Find a string in a running batch file and replace it.
    « Reply #2 on: January 11, 2009, 04:48:48 PM »
    That is what it sound slike to me.  ;)
    Wild guess. Maybe what he really wants is a replacement at run time. It will get  a new string  to tack onto each file in a group.

    BatchFileCommand

      Topic Starter


      Hopeful
    • Thanked: 1
      Re: Find a string in a running batch file and replace it.
      « Reply #3 on: January 11, 2009, 06:52:52 PM »
      Neither of you are correct, so I'll explain this again. My batch file has a lot of msg * popups. So I want to give them the option of replacing the the msg* popups. So, I want to find and replace the msg * popups, so in a way I need the batch file to alter itself, but not literally. So, I need a code that will find and replace a string of code.
      οτη άβγαλτος μεταφ βαθμολογία

      Helpmeh



        Guru

      • Roar.
      • Thanked: 123
        • Yes
        • Yes
      • Computer: Specs
      • Experience: Familiar
      • OS: Windows 8
      Re: Find a string in a running batch file and replace it.
      « Reply #4 on: January 12, 2009, 02:51:54 PM »
      You do know that it won't be REAL TIME...You might be able to change the string, then call itself?...I might just be dreaming...
      Where's MagicSpeed?
      Quote from: 'matt'
      He's playing a game called IRL. Great graphics, *censored* gameplay.

      Geek-9pm


        Mastermind
      • Geek After Dark
      • Thanked: 1026
        • Gekk9pm bnlog
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: Find a string in a running batch file and replace it.
      « Reply #5 on: January 12, 2009, 03:15:42 PM »
      OH BOY  :o Recursion  in a batch file. Who needs java! We can now do it in a batch file. Maybe the towers of Hanoi in a batch file.  ::)     Wait, I think somebody already did that!

      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 1140
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 11
      Re: Find a string in a running batch file and replace it.
      « Reply #6 on: January 12, 2009, 04:01:52 PM »
      You want a batch file to alter itself?


      Neither of you are correct ... so in a way I need the batch file to alter itself, but not literally.

      now you're contradicting yourself. You want to "alter" the batch file, but not "literally" how? spiritually?

      how about instead, you test within the batch file wether to show the popups, rather then trying to dynamically modify running code.
      I was trying to dereference Null Pointers before it was cool.

      BatchFileCommand

        Topic Starter


        Hopeful
      • Thanked: 1
        Re: Find a string in a running batch file and replace it.
        « Reply #7 on: January 12, 2009, 04:25:32 PM »
        I just thought up a way. When I'm done with the batch file I will just copy the whole thing (in the same batch file) and the copied section will have the messages disabled. The quick and dirty way.... hehe.

        Quote
        Maybe the towers of Hanoi in a batch file.  Roll Eyes     Wait, I think somebody already did that!

        Yeah, someone did do it. 1mb  ::).

        οτη άβγαλτος μεταφ βαθμολογία