Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program startup and shutdown

Status
Not open for further replies.

walkities

Technical User
Oct 4, 2004
31
CA
Im going to be running a menu program that stretches across three-five screens and want to have it startup and shutdown at a certain time everyday. I know the startup can be done with a scheduled task but can the shutdown of the program be done the same?

If not what are some of my alternatives?
 
I take it you are not writing this menu software?

Assuming not, you could schedule a batch file to run and kill the task.

The required command is

tskill 'your task name'
without the quotes

 
Taskkill
Ends one or more tasks or processes. Processes can be killed by process ID or image name.

Syntax
taskkill [/s Computer] [/u Domain\User [/p Password]]] [/fi FilterName] [/pid ProcessID]|[/im ImageName] [/f][/t]

Parameters
/s Computer
Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u Domain\User
Runs the command with the account permissions of the user specified by User or Domain\User. The default is the permissions of the current logged on user on the computer issuing the command.
/p Password
Specifies the password of the user account that is specified in the /u parameter.
/fi FilterName
Specifies the types of process(es) to include in or exclude from termination. The following are valid filter names, operators, and values. Name Operators Value
Hostname eq, ne Any valid string.
Status eq, ne RUNNING|NOT RESPONDING
Imagename eq, ne Any valid string.
PID eg, ne, gt, lt, ge, le Any valid positive integer.
Session eg, ne, gt, lt, ge, le Any valid session number.
CPUTime eq, ne, gt, lt, ge, le Valid time in the format of hh:mm:ss. The mm and ss parameters should be between 0 and 59 and hh can be any valid unsigned numeric value.
Memusage eg, ne, gt, lt, ge, le Any valid integer.
Username eq, ne Any valid user name ([Domain\]User).
Services eq, ne Any valid string.
Windowtitle eq, ne Any valid string.

/pid ProcessID
Specifies the process ID of the process to be terminated.
/im ImageName
Specifies the image name of the process to be terminated. Use the wildcard (*) to specify all image names.
/f
Specifies that process(es) be forcefully terminated. This parameter is ignored for remote processes; all remote processes are forcefully terminated.
/t
Specifies to terminate all child processes along with the parent process, commonly known as a tree kill.
/?
Displays help at the command prompt.
Remarks
The wildcard character (*) is accepted only when specified along with the filters.
Termination for remote processes will always be done forcefully regardless of whether the /f parameter is specified.
Supplying a computer name to the HOSTNAME filter will cause a shutdown and all processes will be stopped.
Use tasklist to determine the Process ID (PID) for the process to be terminated.
Taskkill is a replacement for the Kill tool.
Examples
The following examples show how you can use the taskkill command:

taskkill /pid 1230 /pid 1241 /pid 1253
taskkill /f /fi "USERNAME eq NT AUTHORITY\SYSTEM" /im notepad.exe
taskkill /s srvmain /f /im notepad.exe
taskkill /s srvmain /u maindom\hiropln /p p@ssW23 /fi "IMAGENAME eq note*" /im *
taskkill /s srvmain /u maindom\hiropln /fi "USERNAME ne NT*" /im *
taskkill /f /fi "PID ge 1000" /im *

 
Yes the menu is being designed in Macromedia Director. So essentially I can make two tasks, one that starts the program (.exe) and then the batch file that kills it?
 
It would be better if you could figure out a way that your macromedia program could check the time of day and and end itself. Failing that, yes, have two scheduled tasks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top