Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 01-17-2005, 03:36 PM   #1 (permalink)
 
Newb Techie

Join Date: Jan 2005

Posts: 9

ThePainter666

Default XP bat files ?

Hi,
This will be a simple one for you programmers.

I want to write a .bat file to run in XP that will close a program and then open it again ?
Can anyone give me the script ?
I can do one to start a program but I want one to close and then start.

The reason (if anyone is interested) I use FreeRamXP which sits in the system tray and when Explorer crashes (As it does) it returns without this entry in the sys tray.
It is still running but I cant access it and I have to close it through task manager then reopen it and minimise it to the sys tray again for it to be accessible again.
Which is a bother and if I could just click on a bat fiele it would be easier.

Thanks to anyoe who can help
ThePainter666 is offline  
Old 01-18-2005, 12:47 AM   #2 (permalink)
 
Super Techie

Join Date: Jun 2004

Posts: 312

sippin codeine

Send a message via Yahoo to sippin codeine
Default

It's easier to write a program to do that.
__________________
**[System specs]**

Delphi Enterprise 6 - 7
VB 6.0 - 2005 EE
sippin codeine is offline  
Old 01-18-2005, 01:05 AM   #3 (permalink)
 
Lord Techie

Join Date: Jan 2005

Posts: 8,025

DJ-CHRIS is on a distinguished road

Send a message via AIM to DJ-CHRIS
Default

And about your explorer crashes, was mcafee on your computer or is it currently on it?
DJ-CHRIS is offline  
Old 01-18-2005, 02:09 AM   #4 (permalink)
 
Newb Techie

Join Date: Jan 2005

Posts: 9

ThePainter666

Default

Hi,
I have VB6 but Im not good with it, I only did a 10 hour online course and read a few beginner books, can you tell me the commands to use to start and stop programs ?

No I dont have mc afee.
I used Norton 2003 but now have 2005, same prob ?
I ran Litestep as a replacement shell for a while and that never crashed once.
This happened many times with sp1 and now I have reinstalled XP with SP2 from an intigrated CD I made and it still does it.
ThePainter666 is offline  
Old 01-19-2005, 02:04 PM   #5 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default

Here's the code for the batch file. Just save it in a text file and name it something.bat

Code:
@echo off

taskkill /f /im processname.exe 
start /min processname.exe
Replace the processname.exe with whatever the process name is in the task manager.

You can edit some of the behavior with the switches for each command. The /f means that it'll forcefullly kill the process (careful with that, it could cause instabilities) The /min means it will start the process minimized (it sounded like you wanted it to do that).

This batch file will only work in WinXP due to taskkill not being included with previous OS's.
__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 01-20-2005, 02:53 AM   #6 (permalink)
 
Newb Techie

Join Date: Jan 2005

Posts: 9

ThePainter666

Default

Hi,
Thanks Ill give that a go when I get a minute.
Its the taskkill command I needed, I couldnt find it in the CMD when I typed "Help"
I usually have to stop this process in taskmanager under the process tab - end process because it doesnt show up in the application tab I suppose this method is similar so if there is an instibility I am already going to suffer from it.
These bat's can be handy for some jobs cant they :-)
ThePainter666 is offline  
Old 01-21-2005, 01:58 AM   #7 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default

Oh yeah, bat's are very nice. I'm forced to use em because my dumb work won't switch over to active directory, so I just push out these nice bat files through our novell logon .
__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 01-25-2005, 03:09 AM   #8 (permalink)
 
Newb Techie

Join Date: Jan 2005

Posts: 9

ThePainter666

Default

Hi,
I eventually got around to trying that bat file and it doesnt work.
The Taskkill command isnt recognised ?

When I type help in the cmd prompt it doesnt list a command to end a task only start one ?
ThePainter666 is offline  
Old 01-25-2005, 10:51 AM   #9 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,413

office politics will become famous soon enough

Default

works for me. taskkill.exe should be found in c:\windows\system32

might want to check your path statement
office politics is offline  
Old 01-25-2005, 02:42 PM   #10 (permalink)
 
Newb Techie

Join Date: Jan 2005

Posts: 9

ThePainter666

Default

Hi,
nope its not there.
I unhid hiddes and system files and even did a search but it isnt on my system.
Im in XP Home, what are you in ?
ThePainter666 is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On