Home / Software / Computer programming / help needed with writing a batch file
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: help needed with writing a batch file  (Read 649 times)
dot.kom
Topic Starter
Starter



Posts: 3


« on: November 18, 2009, 08:48:05 AM »

Hello,

I have downloaded the updates that i needed for my Win XP pro. Now I'm trying to write a batch file to start the install of my updates.
I'm able to start the install with the comand: "start" followed by the location, then i used the "then" comand to go to the next update. Th problem is that I want the next update to start after the one before has finished, and not while the first one is still running.
So Will you guys help me please, on how I have to program it, or if there is a better way to accomplish this.   

I'm trying to create something like this so I don't need to download the same updates every time.

Thnx

IP logged
Salmon Trout
Prodigy



Thanked: 501
Posts: 7,363

Computer: Specs
Experience: Guru
OS: Linux variant

1
« Reply #1 on: November 18, 2009, 02:10:57 PM »

What "then command"? I have never heard of it before.

Type start /? at the prompt to see all the options and the syntax including the /WAIT switch.
IP logged

dot.kom
Topic Starter
Starter



Posts: 3


« Reply #2 on: November 19, 2009, 03:44:51 AM »

I have used "then" in a comand line as followed:

start c:\windowsXPsp3
then
start c:\sp3secrityupdate

I have used the then comand like i would use it in VB: first this comand an "then" the second comand. But the problem is that the batch file starts the comands directly behind eachother, what makes that my updates will install simultaneous and not one by one.
But now I will try what you propose, and will let you know if it works for me.
IP logged
Salmon Trout
Prodigy



Thanked: 501
Posts: 7,363

Computer: Specs
Experience: Guru
OS: Linux variant

1
« Reply #3 on: November 19, 2009, 04:55:16 AM »

Wow. I always though that in VB the "then" keyword was used with If tests like this

If A = B then
   C
End If

So can you please direct me to some documentation that shows this other use that you appear to know about?

Also, you cannot rely on using VB keywords in batch files and expecting them to work. You cannot do this with keywords from Pascal, Fortran, C++, Perl, Python or Bash either.
IP logged

Helpmeh
Egghead



Thanked: 116
Posts: 3,583

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #4 on: November 19, 2009, 04:58:27 AM »

The /wait switch only works for non-gui applications. I tried it with firefox...And found the sad truth. 
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
Salmon Trout
Prodigy



Thanked: 501
Posts: 7,363

Computer: Specs
Experience: Guru
OS: Linux variant

1
« Reply #5 on: November 19, 2009, 05:08:51 AM »

The /wait switch only works for non-gui applications. I tried it with firefox...And found the sad truth. 

I just tried it with regedit, notepad, calc, Winword.exe (MS Office 2003) and... "C:\Program Files\Mozilla Firefox\firefox.exe" ...

You did remember the title string? (trawl the forums and see how often this catches people out)



IP logged

Helpmeh
Egghead



Thanked: 116
Posts: 3,583

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #6 on: November 19, 2009, 01:21:45 PM »

How come ff works for you and not me?!
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
Salmon Trout
Prodigy



Thanked: 501
Posts: 7,363

Computer: Specs
Experience: Guru
OS: Linux variant

1
« Reply #7 on: November 19, 2009, 01:45:13 PM »

How come ff works for you and not me?!

pls confirm you are using this format

Code: [Select]
start /wait "title" "path\Program"
"title" can be just 2 quotes "" but it can't be omitted

"path\Program" needs quotes if there are any spaces

try this

Code: [Select]
start /wait "" calc
IP logged

Helpmeh
Egghead



Thanked: 116
Posts: 3,583

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #8 on: November 19, 2009, 03:14:25 PM »

pls confirm you are using this format

Code: [Select]
start /wait "title" "path\Program"
"title" can be just 2 quotes "" but it can't be omitted

"path\Program" needs quotes if there are any spaces

try this

Code: [Select]
start /wait "" calc



That may be why. I have never used start other than
start PATH\PROGRAM

I also didn't add the path, because just doing

start firefox

works fine.
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
dot.kom
Topic Starter
Starter



Posts: 3


« Reply #9 on: November 23, 2009, 02:35:59 AM »

Thanks for the info,

the wait switch did it for me.

I have to say that I was wrong with an earlier comand I wrote down here, because the keyword "then" is in dead only used in if tests.
So I'm sorry about that mistake.

Anyway, thanks for the help.
IP logged
Helpmeh
Egghead



Thanked: 116
Posts: 3,583

Experience: Experienced
OS: Windows XP


Roar.

1
« Reply #10 on: November 23, 2009, 04:07:30 AM »

There is no THEN command, therefore, you can not use it in IF tests. You are thinking of some other language, VB perhaps?
IP logged

Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.
Salmon Trout
Prodigy



Thanked: 501
Posts: 7,363

Computer: Specs
Experience: Guru
OS: Linux variant

1
« Reply #11 on: November 23, 2009, 04:48:39 AM »

There is no THEN command, therefore, you can not use it in IF tests. You are thinking of some other language, VB perhaps?

Read the previous posts; this was established on Nov 19.
IP logged

Pages: [1] - (Top) Print 
Home / Software / Computer programming / help needed with writing a batch file « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.103 seconds with 20 queries.