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

Author Topic: Batch files ?!!!!?  (Read 5197 times)

0 Members and 1 Guest are viewing this topic.

sarah516

  • Guest
Batch files ?!!!!?
« on: February 26, 2007, 07:26:48 AM »
Hi,

I am using a batch file to silently install an application and then later in the batch file refer to that installed app.

One problem I am facing is that in my batch file:
line#1 creates the app
line#2 refers to a file created by line#1

the PROBLEM is that by the time line#2 is called, line#1 has not completed creating the app, so I get a msg that the file&folder I am looking for does not exist! :o

Is there any way to make the batch file wait until the entire application is created?  ::)

Also, second question... is it possible to use some sort of condition to:
if(app does not exist)
    create app
else
    just keep going  8-)


Thanks

iandrewmartin

  • Guest
Re: Batch files ?!!!!?
« Reply #1 on: February 26, 2007, 11:33:55 PM »
Hi sarah516;

Look you can do this very easily by simply using a start wait call.
More info: http://www.computerhope.com/starthlp.htm

your command line would thus be something like:

start /wait [command/program]

This ensures that your programs do not trip over each other while trying to complete.

Hope this helps you out.

Carbon Dudeoxide

  • Global Moderator

  • Mastermind
  • Thanked: 169
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Experience: Guru
  • OS: Mac OS
Re: Batch files ?!!!!?
« Reply #2 on: March 03, 2007, 08:09:29 AM »
Depending on how long it takes to install the program, you could try this:

@echo off
(((put your code to install the program)))
PING Insert 7=(8-1) second delay
PING Insert 7=(8-1) second delay
PING Insert 7=(8-1) second delay
(that will delay for maybe around 6 seconds)
(((put the code to refer to the program)))

Basically PING Insert 7=(8-1) second delay puts in a delay between commands.

Hope it helps.

lordoftheplat



    Hopeful

  • teh god.
  • Thanked: 1
    Re: Batch files ?!!!!?
    « Reply #3 on: March 03, 2007, 08:22:45 AM »
    carbon dudeoxide i dont think ur way is really good because if u do that
    the file might still be not there so use the "start /wait [command/program]" way
    that will ensure that the file would be there  
    zepperblood.deviantart.com

    Carbon Dudeoxide

    • Global Moderator

    • Mastermind
    • Thanked: 169
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Experience: Guru
    • OS: Mac OS
    Re: Batch files ?!!!!?
    « Reply #4 on: March 03, 2007, 08:49:53 AM »
    I typed start /wait /? in command prompt and it seems very complicating...just have to know how to use it...

    rockerest



      Hopeful
      • Yes
    • Experience: Experienced
    • OS: Windows 7
    Re: Batch files ?!!!!?
    « Reply #5 on: March 03, 2007, 04:37:54 PM »
    Why are we trying to silently install an application?

    edit:
    And then run it?
    « Last Edit: March 03, 2007, 04:38:12 PM by rockerest »
    In general, the PEBKAC.  Whether it's now or was three weeks ago, the PEBKAC.
    Unsafe browsing and general computer / internet illiteracy IS the users problem.  Don't have sex if you don't know how to use a condom.
    Also, there are 10 types of people in the world, those who understand binary, and those who don't.

    lordoftheplat



      Hopeful

    • teh god.
    • Thanked: 1
      Re: Batch files ?!!!!?
      « Reply #6 on: March 04, 2007, 05:53:18 AM »
      maybe people want to start a keylogger to log what theif kids are doing or something
      zepperblood.deviantart.com

      Calum

      • Moderator


      • Egghead

        Thanked: 238
        • Yes
        • Yes
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Other
      Re: Batch files ?!!!!?
      « Reply #7 on: March 04, 2007, 08:09:50 AM »
      . . . or for other, more sinister reasons.
      I don't think it is wise to proceed any further before we know what's going on here.

      lordoftheplat



        Hopeful

      • teh god.
      • Thanked: 1
        Re: Batch files ?!!!!?
        « Reply #8 on: March 04, 2007, 10:39:25 PM »
        dont think so negatively
        zepperblood.deviantart.com

        Carbon Dudeoxide

        • Global Moderator

        • Mastermind
        • Thanked: 169
          • Yes
          • Yes
          • Yes
        • Certifications: List
        • Experience: Guru
        • OS: Mac OS
        Re: Batch files ?!!!!?
        « Reply #9 on: March 04, 2007, 10:53:06 PM »
        Quote
        . . . or for other, more sinister reasons.
        I don't think it is wise to proceed any further before we know what's going on here.

        Lol, sarah, what exactly are you trying to do?

        Calum

        • Moderator


        • Egghead

          Thanked: 238
          • Yes
          • Yes
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Other
        Re: Batch files ?!!!!?
        « Reply #10 on: March 05, 2007, 12:32:36 PM »
        Quote
        dont think so negatively
        I think negatively, then I am pleasantly surprised if I am wrong.
        And this does sound fishy to me.

        dworley



          Beginner

          Thanked: 1
          Re: Batch files ?!!!!?
          « Reply #11 on: March 05, 2007, 02:26:40 PM »
          you guys are thinking way too negatively. i work at a computer company and we silently install programs all the time on client computers. the beauty of silent install is that it doesn't bother/confuse the current user with open windows, and also leaves less chance that they'll "accidentally" close a window that's doing something important.

          trying to do something unnoticed doesn't mean you're doing something devious.

          -darryl
          Have you forgotten?

          Calum

          • Moderator


          • Egghead

            Thanked: 238
            • Yes
            • Yes
          • Certifications: List
          • Computer: Specs
          • Experience: Beginner
          • OS: Other
          Re: Batch files ?!!!!?
          « Reply #12 on: March 05, 2007, 02:29:15 PM »
          OK, I guess.
          Still, it could be malicious.
          Can't be too careful.