Help - Search - Members - Calendar
Full Version: start and stop programs with batch?
Neowin Forums > Windows Support > Windows Tips, Tricks & Tweaks
JiveMasterT
i wanna write a batch or some sort of script that will kill a given set of programs before i play a game, and then be able to double click another bat file that will launch all of those programs again after the game.

i figured out how to use the @call command to launch one program, but it doesnt wanna just continue on to the next program. any help or ideas? thanks.
zeta
Starting those programs can be accomplished by using "start" in NT/2k/XP--it'll spin-off another shell to execute that program, so you can continue on with what you're doing. I'm not sure about the reverse though--it'd be difficult to obtain the process ID's of the processes you want to terminate.
JiveMasterT
QUOTE(zeta @ Jan 5 2005, 02:56)
Starting those programs can be accomplished by using "start" in NT/2k/XP--it'll spin-off another shell to execute that program, so you can continue on with what you're doing. I'm not sure about the reverse though--it'd be difficult to obtain the process ID's of the processes you want to terminate.
[right][snapback]585233412[/snapback][/right]


when i use the start command it just opens up command prompt windows. here is my batch file so far...

QUOTE
@start "C:\Program Files\GetRight\getright.exe"
@start "C:\Program Files\Palm\HOTSYNC.EXE"
@start "C:\Program Files\Pixoria\Konfabulator\Konfabulator.exe"
@start "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"


oh and i found an app that kills a program based on its name and if i can figure out how to execute all of these programs i can write that up as launching a program in the batch file.
JiveMasterT
ah, i figured it out... for anyone that wants it...

QUOTE
cd "C:\Program Files\GetRight"
start getright
cd "C:\Program Files\Palm"
start HOTSYNC
cd "C:\Program Files\Pixoria\Konfabulator"
start Konfabulator
cd "C:\Program Files\Stardock\ObjectDock"
start ObjectDock


thats the sorta syntax you gotta use. works like a charm.
Slimy
cool, this might come in handy, thank you
zeta
Try using start in conjunction with the /B switch. I've never really used it for starting up GUI apps, so I'm not sure what sort of interaction there'll be.
cpugeniusmv
try this:
CODE
@start "" "C:\Program Files\GetRight\getright.exe"
@start "" "C:\Program Files\Palm\HOTSYNC.EXE"
@start "" "C:\Program Files\Pixoria\Konfabulator\Konfabulator.exe"
@start "" "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"

the reason for the extra quotes is because the first set of quotes indicates the Text for the Titlebar of the command window.

to kill a task:

CODE
taskkill /f /im mspaint.exe
(note: i believe taskkill only comes with XP Pro)
NienorGT
QUOTE(cpugeniusmv @ Jan 5 2005, 00:53)
CODE
taskkill /f /im mspaint.exe
(note:  i believe taskkill only comes with XP Pro)
[right][snapback]585233984[/snapback][/right]
Don't work in Windows 2003 STD blink.gif

ERROR: The remonte system must be running Windows 2000 or above.
wasabi
How to stop Running Processes (includes symantec,avg and sygate)
(they must have the same name as described in services. the below removes access to internet also.
All inorder to free up resources for better game/application work
completly safe
run the lower one (start) to restart them

QUOTE
NET STOP "Cryptographic Services"

NET STOP "DHCP Client"

NET STOP "DNS Client"

NET STOP "Network Connections"

NET STOP "Norton AntiVirus Auto Protect Service"

NET STOP "Print Spooler"

NET STOP "Protected Storage"

NET STOP "Remote Access Auto Connection Manager"

NET STOP "Shell Hardware Detection

NET STOP "Symantec Event Manager"

NET STOP "Task Scheduler"

NET STOP "Themes"

NET STOP "Windows Management Instrumentation"

NET STOP "Windows Time"

NET STOP "AVG7 Alert Manager Server"

NET STOP "AVG7 Update Service"

NET STOP "Sygate Personal Firewall Pro"


@PAUSE



Start Processes again
QUOTE
NET START "Cryptographic Services"

NET START "DHCP Client"

NET START "DNS Client"

NET START "Network Connections"

NET START "Norton AntiVirus Auto Protect Service"

NET START "Print Spooler"

NET START "Protected Storage"

NET START "Remote Access Auto Connection Manager"

NET START "Shell Hardware Detection

NET START "Symantec Event Manager"

NET START "Task Scheduler"

NET START "Themes"

NET START "Windows Management Instrumentation"

NET START "Windows Time"

NET START "AVG7 Alert Manager Server"

NET START "AVG7 Update Service"

NET START "Sygate Personal Firewall Pro"
babaan
Or you use FSAutoStart from http://www.kensalter.com/fsautostart/

CODE
Description:

FSAutoStart gives the user the ability to automatically shutdown services and programs to provide as much resources to running today's most demanding games and applications.  It also provides the ability to launch selected programs after the selected application is launched.  Lastly, it can automatically restart those programs and services previously shutdown, thus bringing the computer back to its original state.  It also adds performance enhancing options like Defragment Memory.


Itīs Free ;)
war
Well my batch file kills all services and programs then launchs my game and then waits for the game to quit and then automatticly relaunchs all services and programs. Its done with the /wait or /w switch. hehe

So only have to run batch once. And I hide the window using ConsoleTool /HIDE. Search google. wink.gif I also perfer to use process -q and process -k. Again google. wink.gif

Well since all the services where already posted above here is just a sample, part of my quake 3 config.

CODE


@echo off
ConsoleTool /HIDE
Start /d"E:\Program Files\Quake III Arena" Minimizer.exe
Start /d"E:\Program Files\Quake III Arena" gapa.exe
CHOICE.COM /N /CY /TY,4 >NUL
Start /w /d"E:\Program Files\Quake III Arena" quake3.exe +set fs_game q3ut3 +nosplash +set com_hunkmegs 128 +com_zoneMegs 32 +com_soundmegs 8 +seta s_khz "22" +_windowed_mouse 1 -dinput
CHOICE.COM /N /CY /TY,3 >NUL
process -q Minimizer.exe
CHOICE.COM /N /CY /TY,3 >NUL
process -k gapa.exe
cls



Thats the better way to use start, notice no cd bs. smile.gif

Oh and I use CHOICE.COM too which pauses the batch file for time. Again google it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.