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

Author Topic: .batch file problem  (Read 2356 times)

0 Members and 1 Guest are viewing this topic.

deathavenger13

    Topic Starter


    Greenhorn

    .batch file problem
    « on: December 14, 2007, 09:06:56 AM »
    ok..i have a problem with a .batch file im running.... lets say i open "a.bat" the code i have so far is:
    Code: [Select]
    echo (
    start iexplore.exe www.google.com
    exit
    )
    >"a1.bat
    start a1.bat
    now i know this is wrong...i also tried
    Code: [Select]
    echo start iexplore.exe www.google.com|exit>"a1.bat
    start a1.bat

    ..now before u start saying "just do 'start www.google.com'", i NEED to open google through this format, and be able to for future reference, and not just opening google...
    thx all!

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: .batch file problem
    « Reply #1 on: December 14, 2007, 09:37:51 AM »
    In the TV version of M*A*S*H, Major Charles Emerson Winchester said he did one thing at a time, did it very well and then moved on.

    Words to live by. Don't try to do everything at once:

    Code: [Select]
    echo start iexplore.exe www.google.com > a1.bat
    echo exit >> a1.bat

    Once a1.bat is created, you can launch the program with start a1.bat

     8)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein

    deathavenger13

      Topic Starter


      Greenhorn

      Re: .batch file problem
      « Reply #2 on: December 15, 2007, 02:07:09 AM »
      thanks Sidewinder ;)! that really helped, and now it doesnt break anymore ;D

      deathavenger13

        Topic Starter


        Greenhorn

        Re: .batch file problem
        « Reply #3 on: December 17, 2007, 04:42:06 AM »
        I've come across another problem with this...
        Code: [Select]
        ...
        echo echo Hello World >> a1.bat
        echo pause>nul >> a1.bat
        ...
        appears to work fine, but when I call or start a1.bat it is just "pause" instead of "pause>nul". Is there anyway to get it to say "pause>nul" through the format above? And if not, is there anyway I can do this that is automated?
        Thx!

        Sidewinder



          Guru

          Thanked: 139
        • Experience: Familiar
        • OS: Windows 10
        Re: .batch file problem
        « Reply #4 on: December 17, 2007, 05:18:12 AM »
        Try using the escape character (^):

        Code: [Select]
        echo pause ^> nul >> a1.bat

         8)
        The true sign of intelligence is not knowledge but imagination.

        -- Albert Einstein