Question about writing a batch file


Limp Gawd
Feb 17, 2004

Im not quite sure if this is possible , but heres what im trying to do. I made a special batch file for a game that I have because when I try to run it with a few programs running it gives me problems. The game is KOTOR and the programs that are giving me trouble are YzDock and the AVG resident sheild.

I have created this batch file so it will kill these two processes before running the game...

net stop "AVG6 Service"
taskkill.exe YzDock.exe

Now what I am attempting to do is run my game using the settings above , but after I exit out of the game I want the batch file to go and restart the two processes that I previouslly killed , but only after I exit out of the game.

Is this even possible? Im using XP Home if it matters. Any help would be appricated. Cheers.

hmm i don't know but a goold alternative would be to make a Macro
. check out EZMacros
net stop "AVG6 Service"
taskkill.exe YzDock.exe
net start "AVG6 Service"

If you don't use the start command, then windows will wait till each program executes and closes before moving on to the next line
Or put a pause after Start /High Kotor, and it will ask you to press a key. ;)

Why do you need to do these things for kotor? Are these workarounds for known issues?
It should probably go something like this i tested this out with a similar game and objectdock so this should work for you. I'll give an example of what it should look like, of course depending on the locations of your programs, the directories will vary.

@echo off
Net Stop "AVG6 Service"
Taskkill /f /im yzdock.exe
Start /wait C:\games\Kotor\Kotor.exe
Net Start "AVG6 Service"
Start c:\progra~1\Yzdock\yzdock.exe

You can see that i put a tilde 1 (~1) for program files since bat files don't like spaces in them (or at least i don't think they do since they never work for me, unless i am doing something wrong) anyway give that a shot.
A batch file will resume after each task, but for more power and flexibility you may try using winscript (Windows Scripting Files) instead.

Thanks for the replys , Ill give it a try when I get home. I dont think that its really a known issue with KOTOR but ive noticed that if I have both of these running sometimes certain games will just minimise to the taskbar for no apparent reason... Kind of sucks when you are playing and just beat a terribly diffucult part only to have the program magically minimise to the taskbar and then crash :)

Also its kind of nice to kill off a few services anyways just for the fact that it saves some ram and cpu time. Anyways thanks again for the help guys. Cheers