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

Author Topic: question on creating a batch file  (Read 14203 times)

0 Members and 1 Guest are viewing this topic.

floridian2005

  • Guest
question on creating a batch file
« on: June 15, 2007, 04:56:58 AM »
Hi,

I would like to start a different application (say B.exe) automatically when I start one application (say A.exe) ? If I had to write a batch file for doing this, how would I do it? Appreciate your help very much. Thanks in advance.

Carbon Dudeoxide

  • Global Moderator

  • Mastermind
  • Thanked: 169
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Experience: Guru
  • OS: Mac OS
Re: question on creating a batch file
« Reply #1 on: June 15, 2007, 05:21:07 AM »
So do you mean something like this: When you open Microsoft Word, it opens Microsoft Excel as well as Word. (examples)

floridian2005

  • Guest
Re: question on creating a batch file
« Reply #2 on: June 15, 2007, 07:21:23 AM »
yes, exactly

Carbon Dudeoxide

  • Global Moderator

  • Mastermind
  • Thanked: 169
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Experience: Guru
  • OS: Mac OS
Re: question on creating a batch file
« Reply #3 on: June 15, 2007, 07:56:32 AM »
I don't think thats possible with a batch file...or any program/programming languages I know of. You can start 2 programs with a batch file but it can't do what you're trying to do.

contrex

  • Guest
Re: question on creating a batch file
« Reply #4 on: June 15, 2007, 08:37:51 AM »
floridian, if you write a batch file like this

Code: [Select]
start "" "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE"
start "" "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE"

You need to check the exact program paths, they may be different.

So you see the syntax of the start command would be

start "" "path to\program file1.exe"
start "" "path to\program file2.exe"

etc




When you run it, both programs will start


Carbon Dudeoxide

  • Global Moderator

  • Mastermind
  • Thanked: 169
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Experience: Guru
  • OS: Mac OS
Re: question on creating a batch file
« Reply #5 on: June 15, 2007, 08:44:24 AM »
Yes, and you can convert this to an EXE with the icon of the origional application so whenever you click this exe, it launches two programs.

ghostdog74



    Specialist

    Thanked: 27
    Re: question on creating a batch file
    « Reply #6 on: June 15, 2007, 08:52:10 AM »
    I don't think thats possible with a batch file...or any program/programming languages I know of. You can start 2 programs with a batch file but it can't do what you're trying to do.
    yes, you can't do that in DOS but if OP is really opening Excel to open Word to do something, it can be done using macros.
    Code: [Select]
    Sub TestCallFromExcel()
        Dim wdApp As Word.Application
        Set wdApp = New Word.Application
        With wdApp
            'Open Word document
            .Documents.Open Filename:="C:\temp\test.doc"
            .Visible = True
            With .Selection
                .TypeText ("testing 1234")
            End With
            .ActiveDocument.Save
            'Exit Word
            .Quit
        End With
            'Release object variable
        Set wdApp = Nothing
    End Sub

    and then you can call "start myexcel.xls" to start both excel and word.

    contrex

    • Guest
    Re: question on creating a batch file
    « Reply #7 on: June 15, 2007, 08:55:00 AM »
    Yes, and you can convert this to an EXE with the icon of the origional application so whenever you click this exe, it launches two programs.

    How are you converting batches to exes, dudeoxide?


    contrex

    • Guest
    Re: question on creating a batch file
    « Reply #8 on: June 15, 2007, 08:56:32 AM »
    ghostdog, Word and Excel were just 2 examples of programs suggested by dudeoxide. The OP asked a general question.


    Carbon Dudeoxide

    • Global Moderator

    • Mastermind
    • Thanked: 169
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Experience: Guru
    • OS: Mac OS
    Re: question on creating a batch file
    « Reply #9 on: June 15, 2007, 09:05:07 AM »
    Yes, and you can convert this to an EXE with the icon of the origional application so whenever you click this exe, it launches two programs.
    How are you converting batches to exes, dudeoxide?
    I have a program Admin posted a few months ago. Very nice little program. You can add version info and a custom icon and stuff.

    If you or the OP or anyone wants it, i'll post it here.

    ghostdog74



      Specialist

      Thanked: 27
      Re: question on creating a batch file
      « Reply #10 on: June 15, 2007, 09:07:07 AM »
      ghostdog, Word and Excel were just 2 examples of programs suggested by dudeoxide. The OP asked a general question.


      yes i know, thanks. I quote myself
      Quote
      ....but if OP is really opening Excel to open Word to do something....

      floridian2005

      • Guest
      Re: question on creating a batch file
      « Reply #11 on: June 15, 2007, 10:12:45 AM »
      Thank you all very much for the responses. No, it isn't Word and Excel that I need to open.

      But there is an application, which when I run, needs to have this other container app started and running already. A friend had mentioned long ago that he had created something (i remember him saying a "batch" file) so, as soon as he tried running the app, it first started off the container app..so no complaints and no need to remember to start it each time.

      So I was wondering how he might have accomplished that....thanks again!

      Carbon Dudeoxide

      • Global Moderator

      • Mastermind
      • Thanked: 169
        • Yes
        • Yes
        • Yes
      • Certifications: List
      • Experience: Guru
      • OS: Mac OS
      Re: question on creating a batch file
      « Reply #12 on: June 15, 2007, 09:26:28 PM »
      Maybe it's what Contrex posted. Perhaps your fiend clicked the batch file and the two programs started simultaneously

      only_lonely



        Intermediate
        Re: question on creating a batch file
        « Reply #13 on: June 18, 2007, 07:20:58 PM »

        [/quote]
        I have a program Admin posted a few months ago. Very nice little program. You can add version info and a custom icon and stuff.

        If you or the OP or anyone wants it, i'll post it here.
        [/quote]
        so where to get the program to convert it?

        Dark Blade

        • Forum Gaming Master


        • Adviser

          Thanked: 24
          • Yes
        • Experience: Experienced
        • OS: Windows XP
        Re: question on creating a batch file
        « Reply #14 on: June 18, 2007, 07:30:24 PM »
        Is it bat2exe, by any chance?