Computing.Net > Forums > Programming > Closing A Program With BASIC/Batch

Closing A Program With BASIC/Batch

Reply to Message Icon

Original Message
Name: DaleSwanson
Date: August 20, 2005 at 03:32:21 Pacific
Subject: Closing A Program With BASIC/Batch
OS: Win2k
CPU/Ram: P4
Comment:

I would like to know how I can close a program using either BASIC or a batch file. I know you can open with SHELL in BASIC, I'm basicly looking for the opposite of that.


Report Offensive Message For Removal


Response Number 1
Name: wizard-fred
Date: August 20, 2005 at 05:27:49 Pacific
Reply: (edit)

Unless a program is designed for it, there is no graceful way of closing it. BASIC and batch files are essentially single threaded. Once started it expects to come to an end at predefined points under control of the program. At best you can stop the program (Ctrl-Alt_Delete) but the point where the program is running is unknown.


Report Offensive Follow Up For Removal

Response Number 2
Name: DaleSwanson
Date: August 20, 2005 at 09:14:31 Pacific
Reply: (edit)

Hmmm, maybe I wasn't quite clear. I want to stop another program not the QBASIC/batch one.


Report Offensive Follow Up For Removal

Response Number 3
Name: uli_glueck
Date: August 21, 2005 at 22:24:10 Pacific
Reply: (edit)

The NT - Ressource Kit has a Command line tool called kill.exe.
It should work in Win2K also.
(To list the processes use tlist.exe. Also in the ressource kit).

uli


Report Offensive Follow Up For Removal

Response Number 4
Name: Shr0Om
Date: August 23, 2005 at 07:08:54 Pacific
Reply: (edit)

You can kill a program with the command taskkill. Here is an example of how you kill notepad:
taskkill /IM notepad.exe

Just save this in a .bat or a .cmd file.


Report Offensive Follow Up For Removal

Response Number 5
Name: Shr0Om
Date: August 23, 2005 at 07:09:38 Pacific
Reply: (edit)

Ahh, taskkill is used in WinXp.. Dunno if it works in w2k.


Report Offensive Follow Up For Removal


Response Number 6
Name: wizard-fred
Date: August 25, 2005 at 23:00:13 Pacific
Reply: (edit)

Killing an application might be fine if it is not doing anything important. If the application is sending or receiving data, or is a database organizing data then there has to be a method of notifying the original caller of the program that the process was interupted. Note that you may lose data if you doing an inplace sort using ram for temporary storage.


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Closing A Program With BASIC/Batch

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge