BleepingComputer.com: Batch Programs

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Batch Programs

#1 User is offline   yano 

  • I can see what you post!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 6,469
  • Joined: 14-February 05
  • Gender:Male

Posted 19 May 2005 - 08:25 PM

Its been a while since I've used the command prompt (DOS).

Ok here is what I've done, I've created 3 batch files (with each of there own commands), and I wanna create a batch file that will load all 3 of them at the same time and execute each one of them simultaneously.

Here is what i got:

@echo off
call ssy.bat
call ssy2.bat
call ssy3.bat

When I execute that it takes forever and only starts the one...

Could anyone help me, or at least help me create a file that will start these 3 at once?

This post has been edited by yanowhiz: 19 May 2005 - 08:28 PM


#2 User is offline   Phantasmagoria 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 53
  • Joined: 15-April 05

Posted 19 May 2005 - 09:16 PM

Maybe your main one should call ssy.bat, then ssy.bat should call ssy2.bat, etc.

Heh, I don't do much batch programming (call me an idiot, but this is why), but that's where I would start and go from there :thumbsup:

#3 User is offline   yano 

  • I can see what you post!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 6,469
  • Joined: 14-February 05
  • Gender:Male

Posted 19 May 2005 - 09:32 PM

But ssy.bat, ssy2.bat, and ssy3.bat each do different things...

#4 User is offline   Leurgy 

  • Voted most likely
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 3,744
  • Joined: 19-September 04
  • Gender:Male
  • Location:Collingwood, Ontario, Canada

Posted 20 May 2005 - 05:19 AM

Hi Yanowhiz

Try taking out the call commands. When you call a file the file that gets called passes execution back to the file that calls. Have your batch file call ssy.bat and in ssy.bat have the line ssy2 and so on. Like Phantasmagoria says.

Heres what my Dos book says:

Quote

The first method of calling a second batch file is simple: include the root name of the second batch file as a line in the first batch file. The first batch file runs the second batch file as though you had typed the second batch file's name at the Dos prompt.


So rather than have ssy2.bat just use ssy2 (thats the root name). As for the call command:

Quote

When Dos executes a call command, Dos temporarily shifts execution to the called batch file. As soon as the called batch file is completed, Dos returns to the first batch file and continues execution with the line immediately following the call command.


So whats happening is ssy.bat executes and then Dos goes back to the call command which is to call ssy.bat and you hang.
**** We use our powers for good, not evil ****
When the only tool you own is a hammer, every problem begins to resemble a nail. Abraham Maslo

#5 User is offline   yano 

  • I can see what you post!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 6,469
  • Joined: 14-February 05
  • Gender:Male

Posted 20 May 2005 - 05:42 AM

Ok I understand what you are saying now, however the actions performed in ssy.bat, ssy2.bat and ssy3.bat loop.

This post has been edited by yanowhiz: 20 May 2005 - 05:43 AM


#6 User is offline   Leurgy 

  • Voted most likely
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 3,744
  • Joined: 19-September 04
  • Gender:Male
  • Location:Collingwood, Ontario, Canada

Posted 20 May 2005 - 06:26 AM

Can't really comment on that unless I know what it is you are trying to do.
**** We use our powers for good, not evil ****
When the only tool you own is a hammer, every problem begins to resemble a nail. Abraham Maslo

#7 User is offline   yano 

  • I can see what you post!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 6,469
  • Joined: 14-February 05
  • Gender:Male

Posted 20 May 2005 - 08:07 AM

Ok this may sound stupid but each of the ssy files is a batch program that generates an infinte loop of a message sent to one of the computers on my network (preferably my brother's lol)

ssy.bat
@Echo off
SHIFT
:Loop
net send ssy hello
GOTO LOOP


ssy2.bat
@Echo off
SHIFT
:Loop
net send ssy what are you doing?
GOTO LOOP


ssy3.bat
@echo off
SHIFT
:loop
net send ssy are you there
GOTO Loop


Of course the name of the computer has been changed and the messages, have been changed ( :thumbsup: :flowers: ) however I want to be able to genereate all 3 at once with just the click of one batch file.

This post has been edited by yanowhiz: 20 May 2005 - 08:08 AM


#8 User is offline   Leurgy 

  • Voted most likely
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 3,744
  • Joined: 19-September 04
  • Gender:Male
  • Location:Collingwood, Ontario, Canada

Posted 20 May 2005 - 09:09 AM

Its been so long since I've done any Dos..............

You know what they say, use it or lose it.
**** We use our powers for good, not evil ****
When the only tool you own is a hammer, every problem begins to resemble a nail. Abraham Maslo

#9 User is offline   yano 

  • I can see what you post!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 6,469
  • Joined: 14-February 05
  • Gender:Male

Posted 20 May 2005 - 09:15 AM

Yea I use to be very good with DOS when I was younger, however I haven't used it since like 1999. So yea, my DOS skills have faded.

#10 User is offline   LoLucky 

  • Forum Regular
  • PipPipPip
  • Find Topics
  • Group: Members
  • Posts: 331
  • Joined: 11-October 04

Posted 20 May 2005 - 02:26 PM

Ummm... first Why Using SHIFT?
Second Simple way do it is encapsulate the other net sends with the first one and only have one file run.

REM Example.bat
@ECHO OFF
:LOOP
NET SEND PEPSI SCANNING… BOTTLE
NET SEND PEPSI NO FINGER FOUND!
NET SEND PEPSI ENJOY YOUR PEPSI!
GOTO LOOP


Or if you want to keep it 3 batch files you could use this example

REM Example1.bat
@ECHO OFF
NET SEND PEPSI SCANNING… BOTTLE
Example2

REM Example2.bat
@ECHO OFF
NET SEND PEPSI NO FINGER FOUND!
Example3

REM Example3.bat
@ECHO OFF
NET SEND PEPSI ENJOY YOUR PEPSI!
Example1


But as for sending it simultaneously the messenger service will not allow that anyway and eventually the batch files will become out of sync.

This post has been edited by LoLucky: 20 May 2005 - 02:27 PM


#11 User is offline   yano 

  • I can see what you post!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 6,469
  • Joined: 14-February 05
  • Gender:Male

Posted 20 May 2005 - 03:30 PM

LoLucky, on May 20 2005, 03:26 PM, said:

REM Example.bat
@ECHO OFF
:LOOP
NET SEND PEPSI SCANNING… BOTTLE
NET SEND PEPSI NO FINGER FOUND!
NET SEND PEPSI ENJOY YOUR PEPSI!
GOTO LOOP

Perfet, exactly what I wanted. Thank you. :thumbsup:

#12 User is offline   LoLucky 

  • Forum Regular
  • PipPipPip
  • Find Topics
  • Group: Members
  • Posts: 331
  • Joined: 11-October 04

Posted 23 May 2005 - 03:29 PM

N/P Yano have fun flooding your brother =)

#13 User is offline   yano 

  • I can see what you post!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 6,469
  • Joined: 14-February 05
  • Gender:Male

Posted 23 May 2005 - 06:25 PM

Thank you. :thumbsup:

I did! :flowers: It was so funny (he won't let me do it anymore :trumpet: ) but I think I could sneak it in again. :inlove:

He was outside doing something; and while he was outside I sent the program and let it run for like 30 minutes. (hehe) and when he came back in, he was so pissed, that he restarted. I told him you could just log-off and back on, or just put it off to the side. :cool:

This post has been edited by yanowhiz: 23 May 2005 - 06:26 PM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users