Help with this .bat

Silvio

Argentinean Dogo
Joined
18 Mar 2004
Messages
156
I made (well..not really, since i know nothing about programming, i just modified one that i found :D ) this little .bat.
################################

@echo off

if [%min%]==[1] goto 2
set min=1
start /min Opera.bat
goto end

:2
set min=
cls

cd "C:\Archivos de programa\Pop-Up Stopper Professional\"
start PopUpStopperProfessional.exe
cd "C:\Archivos de programa\Opera7\"
start opera.exe

:end
exit

#########################################

It opens Opera and a Pop up blocker.
I use it as a direct access to open both apps with just one click.
My question is:
Can it be modified in first place, to check if the Pop up blocker (PopUpStopperProfessional.exe) is running in the background and THEN not open it and open ONLY Opera.exe?
I mean something like this:
Start->check if the popup blocker is running->Yes->a) - No->b)
a)open ONLY opera.exe
b)open BOTH apps
Hope i made myself clear :rolleyes:
Thanks!
 
Well, you can throw in "taskkill /f opera.exe" and "taskkill /f PopUpStopperProfessional.exe" before your start commands. Will that work just as well? /F is just to force it to close down without asking petty questions.
 
Here is a quick little program I threw togeather just for you. I also included space for up to 2 other programs.

* up to 4 paths can be run in succession
* they can be in any order, but unused paths must be left blank
* a process can be defined alone if it is set in the system PATH
* if a running process is found it will not be made to run again
* see about for more details

Anyone can take advantage of this program, it is quite dynamic.

** see below for updated link **
 
Chaos, nice program. But it doesn't seem to really check if the process already runs. Tried with notepad.exe and calc.exe.

For a batch file solution, to start two programs this one would do.

start "" "C:\Archivos de programa\Pop-Up Stopper Professional\PopUpStopperProfessional.exe" /min
start "" "C:\Archivos de programa\Opera7\opera.exe"


Does PopUpStopper run two instances? If not it wouldn't be necessary to check if the program already runs.

In XP Pro (or if you have borrowed the tasklist utility from a Pro installation) this batch will check

tasklist | find "PopUpStopperProfessional.exe"
if errorlevel 1 start "" "C:\Archivos de programa\Pop-Up Stopper Professional\PopUpStopperProfessional.exe" /min
start "" "C:\Archivos de programa\Opera7\opera.exe"


Why do you need a popupstopper in Opera?
 
Wow, thanks for your help.
Let me see,
Unwonted; good idea about Taskkill, its so simple and i didnt think about, i think i´ll work if there is one proccess working, i ll try it and see what happens when there is not one. ;)
Chaos; Thanks for the zip, im sure i´ll use it. :p
Yoyo; why i need a popupstopper in Opera...mmm...im just used to it! :D :D
Again THANKS!
 
yoyo said:
it doesn't seem to really check if the process already runs.
Changed a few things, this new about file should explain how to get the detection to work properly.

If a PATH is defined in the system the process can be named alone. If an invalid path is defined the script will display an error dialog with the name of the failed operation and continue to the next process.

Concerning the system PATH, if you use for instance "notepad" instead of "notepad.exe" the script will not detect the program to be runnning since it is looking for an active process which is actually "notepad.exe". If you want the script to check to see if a process is running before executing a new process then put the extension of the file you are trying to run.

Some valid examples are listed below:



- EXAMPLES -

; is defined in the system PATH, will not detect process
Process=Notepad
Path=

; is defined in the system PATH, detects process
Process=Notepad.exe
Path=

; this is the ideal way to use the program, detects process
Process=Notepad.exe
Path=C:\Windows\system32\

; in both cases below, although the extention there, the process will not be detected since the program is now searching for an entire path, not just the process

Process=
Path=C:\Windows\system32\Notepad.exe

Process=C:\Windows\system32\Notepad.exe
Path=

; this will not work because the way I have defined the running of a process is $path & $process, so it would be trying to run 'C:\windows\system32\Notepad.exeNotepad.exe'
Process=Notepad.exe
Path=C:\Windows\system32\Notepad.exe

**outdated link removed, this file is now part of 'My Scripts & Regs'**
Download Part 1
Download Part 2
 
Last edited:
I wanted a program to begin all the programs I update regularly. Its very similar coding but you can start up to 7 processes, the program will wait for each previous process to end before starting the next.

For things like updating the antivirus in my case I had to define the FULL PATH of the program, otherwise it would be waiting indefinitely for the process to end since it runs resident. Just modify the INI file how you want, same restrictions as 'go'.

The INI comes with my predefined programs so you can get a feel for how you could put your own.

**outdated link removed, this file is now part of 'My Scripts & Regs'**
Download Part 1
Download Part 2
 
Last edited:
Hey Chaos, what about something like this?:
1)Kill proccess X
2)Start proccess Y
3)WHEN i close proccess Y THEN start back proccess X
I have a .bat for doing that and works great but can it be done with AUTO-IT?
I use that for starting games after closing some apps so i can free some resources.

Here is my .bat:
Example:
X=YzDock and Coolmon
Y=Contract Jack Game

###########################
taskkill /F /IM CoolMon.exe
taskkill /F /IM YzDock.exe
cd "C:\Contract JACK\"
start /wait ContractJack.exe
cd "C:\Archivos de programa\CoolMon\"
start Coolmon.exe
cd "C:\Archivos de programa\Yzdock\"
start YzDock.exe
:end
exit
#############################
 
This program was a giant pain in the ass, but I learned alot. :)
An infinite number of kill_processes and start_processes can be defined, albeit following strict input guidelines.

The default INI is listed below; I’ve set it to the standards requested above. They can be modified for any program, make sure there are no spaces in between values. All paths must be defined for the program to work properly, and you must define the number of processes to kill/start.

The DEBUG tool can be used to check your INI if you choose to modify it.


[config]

**careful not to put ANY spaces between values**

Number_To_Kill=2 ; 2 processes wanted to terminate must put 2 here
Kill_Programs=CoolMon.exe,YzDock.exe ; processes are separated only by a ‘,’ no spaces!
Kill_Path_Programs=C:\Archivos de programa\CoolMon\,C:\Archivos de programa\Yzdock\ ; if more than one process is defined above then it’s path must be defined here, no spaces!!

Number_To_Start=1 ; all the same rules apply for any processes defined here
Start_Programs=ContractJack.exe
Start_Path_Programs=C:\Contract JACK\

**outdated link removed, this file is now part of 'My Scripts & Regs'**
Download Part 1
Download Part 2
 
Last edited:
All i can say is...WOW! :eek:
It works as sweets as a candy!!! :D
Chaos, you rule!
I guess we all learn something with this post, i sure did too!!
Again thanks!
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back