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

Author Topic: Have a batch file enter text for you  (Read 19942 times)

0 Members and 1 Guest are viewing this topic.

drewdin

    Topic Starter


    Newbie

    Have a batch file enter text for you
    « on: June 29, 2008, 05:39:18 PM »
    Hi Guys,

    Im new here and to batch files, i was trying to write an easy batch file that would flush my pc's DNS. The way i do it now would be to go to the command window and type ipconfig /dns. Im not sure if this is correct but this is what im thinking. Please correct me where i know im wrong :)

    @echo off
    echo This will Flush your DNS
    pause
    c:\windows\system32\cmd.exe
    type ipconfig /dns

    @echo on

    Thanks

    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: Have a batch file enter text for you
    « Reply #1 on: June 29, 2008, 07:45:07 PM »
    you don't need to start cmd, it starts automatically for a batch
    you only need one line:

    Code: [Select]
    type ipconfig /dns
    in a Batch file.
    or to get the effect you seem to be going for:

    Code: [Select]
    @Echo off
    echo this will flush your DNS
    pause
    ipconfig /dns
    I was trying to dereference Null Pointers before it was cool.

    blastman



      Hopeful

      Re: Have a batch file enter text for you
      « Reply #2 on: June 30, 2008, 03:45:10 AM »
      I've got a batch file I use just for this. (we had issues a while back and the DNS needed to be flushed)

      I don't have it with me, but it was something along the lines of.....

      Code: [Select]
      @echo off
      cls
      echo.
      echo.
      echo.                            Pressing a key will flush your DNS
      echo.
      echo.
      echo.
      pause>nul
      ipconfig /flushdns

      ping localhost>nul

      ipconfig /registerdns

      echo.
      echo.
      echo.           DNS is now flushed. Please see above for any errors
      echo.
      echo.
      echo.
      pause
      exit

      hope it helps.

      Blastman, you are the man. Thank You Very Much!!!!!!!!!



      drewdin

        Topic Starter


        Newbie

        Re: Have a batch file enter text for you
        « Reply #3 on: July 01, 2008, 11:30:36 AM »
        thanks for the info, im a noob and have allot to learn. Where do you reccommend that I start? I have done a bunch of google searches and found some dos command pages but im not sure how to use them. Thanks